PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.2
Elementor Website Builder – more than just a page builder v4.2.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 / base / sub-controls-stack.php

sub-controls-stack.php in Elementor Website Builder – more than just a page builder 4.2.2, at includes/base/sub-controls-stack.php

241 lines 5.3 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 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor sub controls stack.
10 *
11 * An abstract class that can be used to divide a large ControlsStack into small parts.
12 *
13 * @abstract
14 */
15 abstract class Sub_Controls_Stack {
16 /**
17 * @var Controls_Stack
18 */
19 protected $parent;
20
21 /**
22 * Get self ID.
23 *
24 * Retrieve the self ID.
25 *
26 * @access public
27 * @abstract
28 */
29 abstract public function get_id();
30
31 /**
32 * Get self title.
33 *
34 * Retrieve the self title.
35 *
36 * @access public
37 * @abstract
38 */
39 abstract public function get_title();
40
41 /**
42 * Constructor.
43 *
44 * Initializing the base class by setting parent stack.
45 *
46 * @access public
47 * @param Controls_Stack $element_parent
48 */
49 public function __construct( $element_parent ) {
50 $this->parent = $element_parent;
51 }
52
53 /**
54 * Get control ID.
55 *
56 * Retrieve the control ID. Note that the sub controls stack may have a special prefix
57 * to distinguish them from regular controls, and from controls in other
58 * sub stack.
59 *
60 * By default do nothing, and return the original id.
61 *
62 * @access protected
63 *
64 * @param string $control_base_id Control base ID.
65 *
66 * @return string Control ID.
67 */
68 protected function get_control_id( $control_base_id ) {
69 return $control_base_id;
70 }
71
72 /**
73 * Add new control.
74 *
75 * Register a single control to allow the user to set/update data.
76 *
77 * @access public
78 *
79 * @param string $id Control ID.
80 * @param array $args Control arguments.
81 * @param array $options
82 *
83 * @return bool True if added, False otherwise.
84 */
85 public function add_control( $id, $args, $options = [] ) {
86 return $this->parent->add_control( $this->get_control_id( $id ), $args, $options );
87 }
88
89 /**
90 * Update control.
91 *
92 * Change the value of an existing control.
93 *
94 * @access public
95 *
96 * @param string $id Control ID.
97 * @param array $args Control arguments. Only the new fields you want to update.
98 * @param array $options Optional. Some additional options.
99 */
100 public function update_control( $id, $args, array $options = [] ) {
101 $this->parent->update_control( $this->get_control_id( $id ), $args, $options );
102 }
103
104 /**
105 * Remove control.
106 *
107 * Unregister an existing control.
108 *
109 * @access public
110 *
111 * @param string $id Control ID.
112 */
113 public function remove_control( $id ) {
114 $this->parent->remove_control( $this->get_control_id( $id ) );
115 }
116
117 /**
118 * Add new group control.
119 *
120 * Register a set of related controls grouped together as a single unified
121 * control.
122 *
123 * @access public
124 *
125 * @param string $group_name Group control name.
126 * @param array $args Group control arguments. Default is an empty array.
127 * @param array $options
128 */
129 public function add_group_control( $group_name, $args, $options = [] ) {
130 $args['name'] = $this->get_control_id( $args['name'] );
131 $this->parent->add_group_control( $group_name, $args, $options );
132 }
133
134 /**
135 * Add new responsive control.
136 *
137 * Register a set of controls to allow editing based on user screen size.
138 *
139 * @access public
140 *
141 * @param string $id Responsive control ID.
142 * @param array $args Responsive control arguments.
143 * @param array $options
144 */
145 public function add_responsive_control( $id, $args, $options = [] ) {
146 $this->parent->add_responsive_control( $this->get_control_id( $id ), $args, $options );
147 }
148
149 /**
150 * Update responsive control.
151 *
152 * Change the value of an existing responsive control.
153 *
154 * @access public
155 *
156 * @param string $id Responsive control ID.
157 * @param array $args Responsive control arguments.
158 */
159 public function update_responsive_control( $id, $args ) {
160 $this->parent->update_responsive_control( $this->get_control_id( $id ), $args );
161 }
162
163 /**
164 * Remove responsive control.
165 *
166 * Unregister an existing responsive control.
167 *
168 * @access public
169 *
170 * @param string $id Responsive control ID.
171 */
172 public function remove_responsive_control( $id ) {
173 $this->parent->remove_responsive_control( $this->get_control_id( $id ) );
174 }
175
176 /**
177 * Start controls section.
178 *
179 * Used to add a new section of controls to the stack.
180 *
181 * @access public
182 *
183 * @param string $id Section ID.
184 * @param array $args Section arguments.
185 */
186 public function start_controls_section( $id, $args = [] ) {
187 $this->parent->start_controls_section( $this->get_control_id( $id ), $args );
188 }
189
190 /**
191 * End controls section.
192 *
193 * Used to close an existing open controls section.
194 *
195 * @access public
196 */
197 public function end_controls_section() {
198 $this->parent->end_controls_section();
199 }
200
201 /**
202 * Start controls tabs.
203 *
204 * Used to add a new set of tabs inside a section.
205 *
206 * @access public
207 *
208 * @param string $id Control ID.
209 */
210 public function start_controls_tabs( $id ) {
211 $this->parent->start_controls_tabs( $this->get_control_id( $id ) );
212 }
213
214 public function start_controls_tab( $id, $args ) {
215 $this->parent->start_controls_tab( $this->get_control_id( $id ), $args );
216 }
217
218
219 /**
220 * End controls tabs.
221 *
222 * Used to close an existing open controls tabs.
223 *
224 * @access public
225 */
226 public function end_controls_tab() {
227 $this->parent->end_controls_tab();
228 }
229
230 /**
231 * End controls tabs.
232 *
233 * Used to close an existing open controls tabs.
234 *
235 * @access public
236 */
237 public function end_controls_tabs() {
238 $this->parent->end_controls_tabs();
239 }
240 }
241