| 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 |
* @var \Elementor\Core\Document |
| 15 |
*/ |
| 16 |
protected $document; |
| 17 |
|
| 18 |
/** |
| 19 |
* Indicates if the methods are being triggered on page save or at render time (value will be either 'save' or 'render'). |
| 20 |
* |
| 21 |
* @var string |
| 22 |
*/ |
| 23 |
protected $mode = ''; |
| 24 |
|
| 25 |
/** |
| 26 |
* Is Action Needed. |
| 27 |
* |
| 28 |
* Runs only at runtime and used as a flag to determine if all methods should run on page render. |
| 29 |
* If returns false, all methods will run only on page save. |
| 30 |
* If returns true, all methods will run on both page render and on save. |
| 31 |
* |
| 32 |
* @since 3.3.0 |
| 33 |
* @access public |
| 34 |
* |
| 35 |
* @return bool |
| 36 |
*/ |
| 37 |
abstract public function is_action_needed(); |
| 38 |
|
| 39 |
/** |
| 40 |
* Unique Element Action. |
| 41 |
* |
| 42 |
* Will be triggered for each unique page element - section / column / widget unique type (heading, icon etc.). |
| 43 |
* |
| 44 |
* @since 3.3.0 |
| 45 |
* @access public |
| 46 |
* |
| 47 |
* @return void |
| 48 |
*/ |
| 49 |
public function unique_element_action( Element_Base $element_data ) {} |
| 50 |
|
| 51 |
/** |
| 52 |
* Element Action. |
| 53 |
* |
| 54 |
* Will be triggered for each page element - section / column / widget. |
| 55 |
* |
| 56 |
* @since 3.3.0 |
| 57 |
* @access public |
| 58 |
* |
| 59 |
* @return void |
| 60 |
*/ |
| 61 |
public function element_action( Element_Base $element_data ) {} |
| 62 |
|
| 63 |
/** |
| 64 |
* After Elements Iteration. |
| 65 |
* |
| 66 |
* Will be triggered after all page elements iteration has ended. |
| 67 |
* |
| 68 |
* @since 3.3.0 |
| 69 |
* @access public |
| 70 |
* |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
public function after_elements_iteration() {} |
| 74 |
|
| 75 |
public function set_mode( $mode ) { |
| 76 |
$this->mode = $mode; |
| 77 |
} |
| 78 |
|
| 79 |
public function __construct( $document ) { |
| 80 |
$this->document = $document; |
| 81 |
} |
| 82 |
} |
| 83 |
|