module.php
75 lines
| 1 | <?php |
| 2 | namespace Elementor\Modules\History; |
| 3 | |
| 4 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | use Elementor\Plugin; |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly. |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Elementor history module. |
| 13 | * |
| 14 | * Elementor history module handler class is responsible for registering and |
| 15 | * managing Elementor history modules. |
| 16 | * |
| 17 | * @since 1.7.0 |
| 18 | */ |
| 19 | class Module extends BaseModule { |
| 20 | |
| 21 | /** |
| 22 | * Get module name. |
| 23 | * |
| 24 | * Retrieve the history module name. |
| 25 | * |
| 26 | * @since 1.7.0 |
| 27 | * @access public |
| 28 | * |
| 29 | * @return string Module name. |
| 30 | */ |
| 31 | public function get_name() { |
| 32 | return 'history'; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Localize settings. |
| 37 | * |
| 38 | * Add new localized settings for the history module. |
| 39 | * |
| 40 | * Fired by `elementor/editor/localize_settings` filter. |
| 41 | * |
| 42 | * @since 1.7.0 |
| 43 | * @deprecated 3.1.0 |
| 44 | * @access public |
| 45 | * |
| 46 | * @return array Localized settings. |
| 47 | */ |
| 48 | public function localize_settings() { |
| 49 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' ); |
| 50 | |
| 51 | return []; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @since 2.3.0 |
| 56 | * @access public |
| 57 | */ |
| 58 | public function add_templates() { |
| 59 | Plugin::$instance->common->add_template( __DIR__ . '/views/history-panel-template.php' ); |
| 60 | Plugin::$instance->common->add_template( __DIR__ . '/views/revisions-panel-template.php' ); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * History module constructor. |
| 65 | * |
| 66 | * Initializing Elementor history module. |
| 67 | * |
| 68 | * @since 1.7.0 |
| 69 | * @access public |
| 70 | */ |
| 71 | public function __construct() { |
| 72 | add_action( 'elementor/editor/init', [ $this, 'add_templates' ] ); |
| 73 | } |
| 74 | } |
| 75 |