PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / modules / display / positioning / positioning.php

positioning.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at inc/modules/display/positioning/positioning.php

279 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Modules\Display;
4
5 use \Elementor\Controls_Manager;
6
7
8 /**
9 * Author Name: Liton Arefin
10 * Author URL: https://jeweltheme.com
11 * Date: 1/2/20
12 */
13
14 if (!defined('ABSPATH')) {
15 exit;
16 } // Exit if accessed directly.
17
18 if (!class_exists('MasterAddons\Modules\Display\Positioning')) {
19 class Positioning
20 {
21
22 /*
23 * Instance of this class
24 */
25 private static $instance = null;
26
27
28 public function __construct()
29 {
30
31 // Add new controls to advanced tab globally
32 add_action("elementor/element/after_section_end", array($this, 'jltma_add_position_controls_section'), 10, 3);
33 }
34
35
36
37 public function jltma_add_position_controls_section($widget, $section_id, $args)
38 {
39
40 //Link to sections
41 $target_sections = array('section_custom_css');
42
43 if (!defined('ELEMENTOR_PRO_VERSION')) {
44 $target_sections[] = 'section_custom_css_pro';
45 }
46
47 if (!in_array($section_id, $target_sections)) {
48 return;
49 }
50
51 // Don't show on page/document settings
52 $allowed_types = array('widget', 'section', 'column', 'container');
53 if (!in_array($widget->get_type(), $allowed_types)) {
54 return;
55 }
56
57 // Adds Positioning Options
58 $widget->start_controls_section(
59 'ma_el_section_advanced_position',
60 array(
61 'label' => __('Positioning ', 'master-addons' ) . JLTMA_EXTENSION_BADGE,
62 'tab' => Controls_Manager::TAB_ADVANCED
63 )
64 );
65
66 $widget->add_responsive_control(
67 'ma_el_position_type',
68 array(
69 'label' => __('Position Type', 'master-addons' ),
70 'label_block' => true,
71 'type' => Controls_Manager::SELECT,
72 'options' => array(
73 '' => __('Default', 'master-addons' ),
74 'static' => __('Static', 'master-addons' ),
75 'relative' => __('Relative', 'master-addons' ),
76 'absolute' => __('Absolute', 'master-addons' )
77 ),
78 'default' => '',
79 'selectors' => array(
80 '{{WRAPPER}}' => 'position:{{VALUE}};',
81 )
82 )
83 );
84
85 $widget->add_responsive_control(
86 'ma_el_position_top',
87 array(
88 'label' => __('Top', 'master-addons' ),
89 'type' => Controls_Manager::SLIDER,
90 'size_units' => array('px', 'em', '%'),
91 'range' => array(
92 'px' => array(
93 'min' => -2000,
94 'max' => 2000,
95 'step' => 1
96 ),
97 '%' => array(
98 'min' => -100,
99 'max' => 100,
100 'step' => 1
101 ),
102 'em' => array(
103 'min' => -150,
104 'max' => 150,
105 'step' => 1
106 )
107 ),
108 'selectors' => array(
109 '{{WRAPPER}}' => 'top:{{SIZE}}{{UNIT}};'
110 ),
111 'condition' => array(
112 'ma_el_position_type' => array('relative', 'absolute')
113 )
114 )
115 );
116
117 $widget->add_responsive_control(
118 'ma_el_position_right',
119 array(
120 'label' => __('Right', 'master-addons' ),
121 'type' => Controls_Manager::SLIDER,
122 'size_units' => array('px', 'em', '%'),
123 'range' => array(
124 'px' => array(
125 'min' => -2000,
126 'max' => 2000,
127 'step' => 1
128 ),
129 '%' => array(
130 'min' => -100,
131 'max' => 100,
132 'step' => 1
133 ),
134 'em' => array(
135 'min' => -150,
136 'max' => 150,
137 'step' => 1
138 )
139 ),
140 'selectors' => array(
141 '{{WRAPPER}}' => 'right:{{SIZE}}{{UNIT}};'
142 ),
143 'condition' => array(
144 'ma_el_position_type' => array('relative', 'absolute')
145 ),
146 'return_value' => ''
147 )
148 );
149
150 $widget->add_responsive_control(
151 'ma_el_position_bottom',
152 array(
153 'label' => __('Bottom', 'master-addons' ),
154 'type' => Controls_Manager::SLIDER,
155 'size_units' => array('px', 'em', '%'),
156 'range' => array(
157 'px' => array(
158 'min' => -2000,
159 'max' => 2000,
160 'step' => 1
161 ),
162 '%' => array(
163 'min' => -100,
164 'max' => 100,
165 'step' => 1
166 ),
167 'em' => array(
168 'min' => -150,
169 'max' => 150,
170 'step' => 1
171 )
172 ),
173 'selectors' => array(
174 '{{WRAPPER}}' => 'bottom:{{SIZE}}{{UNIT}};'
175 ),
176 'condition' => array(
177 'ma_el_position_type' => array('relative', 'absolute')
178 )
179 )
180 );
181
182 $widget->add_responsive_control(
183 'ma_el_position_left',
184 array(
185 'label' => __('Left', 'master-addons' ),
186 'type' => Controls_Manager::SLIDER,
187 'size_units' => array('px', 'em', '%'),
188 'range' => array(
189 'px' => array(
190 'min' => -2000,
191 'max' => 2000,
192 'step' => 1
193 ),
194 '%' => array(
195 'min' => -100,
196 'max' => 100,
197 'step' => 1
198 ),
199 'em' => array(
200 'min' => -150,
201 'max' => 150,
202 'step' => 1
203 )
204 ),
205 'selectors' => array(
206 '{{WRAPPER}}' => 'left:{{SIZE}}{{UNIT}};'
207 ),
208 'condition' => array(
209 'ma_el_position_type' => array('relative', 'absolute')
210 )
211 )
212 );
213
214 $widget->add_responsive_control(
215 'ma_el_position_from_center',
216 array(
217 'label' => __('From Center', 'master-addons' ),
218 'description' => __('Please avoid using "From Center" and "Left" options at the same time.', 'master-addons' ),
219 'type' => Controls_Manager::SLIDER,
220 'size_units' => array('px', 'em', '%'),
221 'range' => array(
222 'px' => array(
223 'min' => -1000,
224 'max' => 1000,
225 'step' => 1
226 ),
227 '%' => array(
228 'min' => -100,
229 'max' => 100,
230 'step' => 1
231 ),
232 'em' => array(
233 'min' => -150,
234 'max' => 150,
235 'step' => 1
236 )
237 ),
238 'selectors' => array(
239 '{{WRAPPER}}' => 'left:calc( 50% + {{SIZE}}{{UNIT}} );'
240 ),
241 'condition' => array(
242 'ma_el_position_type' => array('relative', 'absolute')
243 )
244 )
245 );
246
247
248 $widget->add_responsive_control(
249 'ma_el_position_zindex',
250 array(
251 'label' => __('Z-Index', 'master-addons' ),
252 'type' => Controls_Manager::NUMBER,
253 'default' => '',
254 'selectors' => array(
255 '{{WRAPPER}}' => 'z-index:{{VALUE}};',
256 )
257 )
258 );
259
260
261 $widget->end_controls_section();
262 }
263
264
265
266 public static function get_instance()
267 {
268 if (!self::$instance) {
269 self::$instance = new self;
270 }
271 return self::$instance;
272 }
273 }
274 }
275
276 if (class_exists('MasterAddons\Modules\Display\Positioning')) {
277 Positioning::get_instance();
278 }
279