GFPDFControllerController_Templates

Controller_Templates A general class for handling AJAX template actions.

Defined (1)

The class is defined in the following location(s).

/src/controller/Controller_Templates.php  
  1. class Controller_Templates extends Helper_Abstract_Controller implements Helper_Interface_Actions { 
  2.  
  3. /** 
  4. * Controller_Templates constructor. 
  5. * Setup our class by injecting all our dependancies 
  6. * @param Helper_Abstract_Model $model 
  7. * @since 4.1 
  8. */ 
  9. public function __construct( Helper_Abstract_Model $model ) { 
  10. /** Load our model */ 
  11. $this->model = $model; 
  12. $this->model->setController( $this ); 
  13.  
  14. /** 
  15. * Setup our class 
  16. * @since 4.1 
  17. */ 
  18. public function init() { 
  19. $this->add_actions(); 
  20.  
  21. /** 
  22. * Add AJAX hooks for templates 
  23. * @since 4.1 
  24. */ 
  25. public function add_actions() { 
  26. /** Add AJAX endpoints */ 
  27. add_action( 'wp_ajax_gfpdf_upload_template', [ $this->model, 'ajax_process_uploaded_template' ] ); 
  28. add_action( 'wp_ajax_gfpdf_delete_template', [ $this->model, 'ajax_process_delete_template' ] ); 
  29. add_action( 'wp_ajax_gfpdf_get_template_options', [ $this->model, 'ajax_process_build_template_options_html' ] );