data
3 years ago
import-export
3 years ago
utils
3 years ago
module.php
3 years ago
usage.php
3 years ago
module.php
67 lines
| 1 | <?php |
| 2 | namespace Elementor\Modules\KitElementsDefaults; |
| 3 | |
| 4 | use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | use Elementor\Modules\KitElementsDefaults\Data\Controller; |
| 7 | use Elementor\Plugin; |
| 8 | use Elementor\Modules\KitElementsDefaults\ImportExport\Import_Export; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; // Exit if accessed directly |
| 12 | } |
| 13 | |
| 14 | class Module extends BaseModule { |
| 15 | |
| 16 | const META_KEY = '_elementor_elements_default_values'; |
| 17 | |
| 18 | public function get_name() { |
| 19 | return 'kit-elements-defaults'; |
| 20 | } |
| 21 | |
| 22 | public static function get_experimental_data() { |
| 23 | return [ |
| 24 | 'name' => 'kit-elements-defaults', |
| 25 | 'title' => __( 'Save as Default', 'elementor' ), |
| 26 | 'description' => __( |
| 27 | 'Maintain consistency across your site by saving the changes to a widget as the default setting for future use. These settings will automatically apply to the widget every time you place it. Note: This feature doesn\'t affect existing widgets.', |
| 28 | 'elementor' |
| 29 | ) . ' <a href="https://go.elementor.com/wp-dash-save-as-default" target="_blank">' . __( 'Learn More', 'elementor' ) . '</a>', |
| 30 | 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE, |
| 31 | 'new_site' => [ |
| 32 | 'default_active' => true, |
| 33 | ], |
| 34 | ]; |
| 35 | } |
| 36 | |
| 37 | private function enqueue_scripts() { |
| 38 | wp_enqueue_script( |
| 39 | 'elementor-kit-elements-defaults-editor', |
| 40 | $this->get_js_assets_url( 'kit-elements-defaults-editor' ), |
| 41 | [ |
| 42 | 'elementor-common', |
| 43 | 'elementor-editor-modules', |
| 44 | 'elementor-editor-document', |
| 45 | ], |
| 46 | ELEMENTOR_VERSION, |
| 47 | true |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | public function __construct() { |
| 52 | parent::__construct(); |
| 53 | |
| 54 | add_action( 'elementor/editor/before_enqueue_scripts', function () { |
| 55 | $this->enqueue_scripts(); |
| 56 | } ); |
| 57 | |
| 58 | Plugin::$instance->data_manager_v2->register_controller( new Controller() ); |
| 59 | |
| 60 | ( new Usage() )->register(); |
| 61 | |
| 62 | if ( is_admin() ) { |
| 63 | ( new Import_Export() )->register(); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 |