PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.2
Elementor Website Builder – more than just a page builder v4.1.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / base.php

base.php in Elementor Website Builder – more than just a page builder 4.1.2, at includes/controls/base.php

157 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use Elementor\Core\Base\Base_Object;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10 /**
11 * Elementor base control.
12 *
13 * An abstract class for creating new controls in the panel.
14 *
15 * @since 1.0.0
16 * @abstract
17 */
18 abstract class Base_Control extends Base_Object {
19
20 /**
21 * Base settings.
22 *
23 * Holds all the base settings of the control.
24 *
25 * @access private
26 *
27 * @var array
28 */
29 private $_base_settings = [
30 'label' => '',
31 'description' => '',
32 'show_label' => true,
33 'label_block' => false,
34 'separator' => 'default',
35 ];
36
37 /**
38 * Get features.
39 *
40 * Retrieve the list of all the available features. Currently Elementor uses only
41 * the `UI` feature.
42 *
43 * @since 1.5.0
44 * @access public
45 * @static
46 *
47 * @return array Features array.
48 */
49 public static function get_features() {
50 return [];
51 }
52
53 /**
54 * Get control type.
55 *
56 * Retrieve the control type.
57 *
58 * @since 1.5.0
59 * @access public
60 * @abstract
61 */
62 abstract public function get_type();
63
64 /**
65 * Control base constructor.
66 *
67 * Initializing the control base class.
68 *
69 * @since 1.5.0
70 * @access public
71 */
72 public function __construct() {
73 $this->set_settings( array_merge( $this->_base_settings, $this->get_default_settings() ) );
74
75 $this->set_settings( 'features', static::get_features() );
76 }
77
78 /**
79 * Enqueue control scripts and styles.
80 *
81 * Used to register and enqueue custom scripts and styles used by the control.
82 *
83 * @since 1.5.0
84 * @access public
85 */
86 public function enqueue() {}
87
88 /**
89 * Control content template.
90 *
91 * Used to generate the control HTML in the editor using Underscore JS
92 * template. The variables for the class are available using `data` JS
93 * object.
94 *
95 * Note that the content template is wrapped by Base_Control::print_template().
96 *
97 * @since 1.5.0
98 * @access public
99 * @abstract
100 */
101 abstract public function content_template();
102
103 /**
104 * Print control template.
105 *
106 * Used to generate the control HTML in the editor using Underscore JS
107 * template. The variables for the class are available using `data` JS
108 * object.
109 *
110 * @since 1.5.0
111 * @access public
112 */
113 final public function print_template() {
114 ?>
115 <script type="text/html" id="tmpl-elementor-control-<?php echo esc_attr( $this->get_type() ); ?>-content">
116 <div class="elementor-control-content">
117 <?php
118 $this->content_template();
119 ?>
120 </div>
121 </script>
122 <?php
123 }
124
125 /**
126 * Get default control settings.
127 *
128 * Retrieve the default settings of the control. Used to return the default
129 * settings while initializing the control.
130 *
131 * @since 1.5.0
132 * @access protected
133 *
134 * @return array Control default settings.
135 */
136 protected function get_default_settings() {
137 return [];
138 }
139
140 public static function get_assets( $setting ) {
141 return [];
142 }
143
144 /**
145 * Update value of control that needs to be updated after import.
146 *
147 * @param mixed $value
148 * @param array $control_args
149 * @param array $config
150 *
151 * @return mixed
152 */
153 public function on_import_update_settings( $value, array $control_args, array $config ) {
154 return $value;
155 }
156 }
157