base.php (1735B)
1 <?php 2 namespace Elementor\Core\Base\Elements_Iteration_Actions; 3 4 use Elementor\Element_Base; 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly 8 } 9 10 abstract class Base { 11 /** 12 * The current document that the Base class instance was created from. 13 */ 14 protected $document; 15 16 /** 17 * Indicates if the methods are being triggered on page save or at render time (value will be either 'save' or 'render'). 18 * 19 * @var string 20 */ 21 protected $mode = ''; 22 23 /** 24 * Is Action Needed. 25 * 26 * Runs only at runtime and used as a flag to determine if all methods should run on page render. 27 * If returns false, all methods will run only on page save. 28 * If returns true, all methods will run on both page render and on save. 29 * 30 * @since 3.3.0 31 * @access public 32 * 33 * @return bool 34 */ 35 abstract public function is_action_needed(); 36 37 /** 38 * Unique Element Action. 39 * 40 * Will be triggered for each unique page element - section / column / widget unique type (heading, icon etc.). 41 * 42 * @since 3.3.0 43 * @access public 44 * 45 * @return void 46 */ 47 public function unique_element_action( Element_Base $element_data ) {} 48 49 /** 50 * Element Action. 51 * 52 * Will be triggered for each page element - section / column / widget. 53 * 54 * @since 3.3.0 55 * @access public 56 * 57 * @return void 58 */ 59 public function element_action( Element_Base $element_data ) {} 60 61 /** 62 * After Elements Iteration. 63 * 64 * Will be triggered after all page elements iteration has ended. 65 * 66 * @since 3.3.0 67 * @access public 68 * 69 * @return void 70 */ 71 public function after_elements_iteration() {} 72 73 public function set_mode( $mode ) { 74 $this->mode = $mode; 75 } 76 77 public function __construct( $document ) { 78 $this->document = $document; 79 } 80 }