PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.15.2
Shortcodes and extra features for Phlox theme v2.15.2
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / modules / common.php
auxin-elements / includes / elementor / modules Last commit date
documents 4 years ago dynamic-tags 2 years ago query-control 3 years ago settings 3 years ago theme-builder 3 years ago column.php 3 years ago common.php 3 years ago section.php 3 years ago templates-types-manager.php 3 years ago
common.php
1090 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Modules;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Image_Size;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Core\Schemes\Color;
10 use Elementor\Core\Schemes\Typography;
11 use Elementor\Control_Media;
12 use Elementor\Group_Control_Border;
13 use Elementor\Group_Control_Box_Shadow;
14 use Elementor\Group_Control_Background;
15
16
17 class Common {
18
19 /**
20 * Instance of this class.
21 *
22 * @var object
23 */
24 protected static $instance = null;
25
26
27 public function __construct(){
28
29 // Add new controls to advanced tab globally
30 add_action( "elementor/element/after_section_end", array( $this, 'add_position_controls_section' ), 10, 3 );
31
32 // Go pro notice for parallax options
33 add_action( "elementor/element/after_section_end", array( $this, 'add_parallax_go_pro_notice' ), 15, 3 );
34 add_action( "elementor/element/after_section_end", array( $this, 'add_transition_controls_section'), 18, 3 );
35
36 add_action( "elementor/element/after_section_end", array( $this, 'add_extra_controls_section' ), 19, 3 );
37 add_action( "elementor/element/after_section_end", array( $this, 'add_pseudo_background_controls' ), 20, 3 );
38 add_action( "elementor/element/after_section_end", array( $this, 'add_custom_css_controls_section'), 25, 3 );
39
40
41 // Renders attributes for all Elementor Elements
42 // add_action( 'elementor/frontend/widget/before_render' , array( $this, 'render_widget_attributes' ) );
43
44 // Render the custom CSS
45 if ( ! defined('ELEMENTOR_PRO_VERSION') ) {
46 add_action( 'elementor/element/parse_css', array( $this, 'add_post_css' ), 10, 2 );
47 }
48 }
49
50 /**
51 * Return an instance of this class.
52 *
53 * @return object A single instance of this class.
54 */
55 public static function get_instance() {
56 // If the single instance hasn't been set, set it now.
57 if ( null == self::$instance ) {
58 self::$instance = new self;
59 }
60
61 return self::$instance;
62 }
63
64 /**
65 * Add custom css control to all elements
66 *
67 * @return void
68 */
69 public function add_custom_css_controls_section( $widget, $section_id, $args ){
70
71 if( 'section_custom_css_pro' !== $section_id ){
72 return;
73 }
74
75 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
76
77 $widget->start_controls_section(
78 'aux_core_common_custom_css_section',
79 array(
80 'label' => __( 'Custom CSS', 'auxin-elements' ),
81 'tab' => Controls_Manager::TAB_ADVANCED
82 )
83 );
84
85 $widget->add_control(
86 'custom_css',
87 array(
88 'type' => Controls_Manager::CODE,
89 'label' => __( 'Custom CSS', 'auxin-elements' ),
90 'label_block' => true,
91 'language' => 'css'
92 )
93 );
94 ob_start();?>
95 <pre>
96 Examples:
97 // To target main element
98 selector { color: red; }
99 // For child element
100 selector .child-element{ margin: 10px; }
101 </pre>
102 <?php
103 $example = ob_get_clean();
104
105 $widget->add_control(
106 'custom_css_description',
107 array(
108 'raw' => __( 'Use "selector" keyword to target wrapper element.', 'auxin-elements' ). $example,
109 'type' => Controls_Manager::RAW_HTML,
110 'content_classes' => 'elementor-descriptor',
111 'separator' => 'none'
112 )
113 );
114
115 $widget->end_controls_section();
116 }
117
118 }
119
120
121
122 /**
123 * Add controls to advanced section for adding background image to pseudo elements
124 *
125 * @return void
126 */
127 public function add_pseudo_background_controls( $widget, $section_id, $args ){
128
129 $target_sections = array('section_custom_css');
130
131 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
132 $target_sections[] = 'section_custom_css_pro';
133 }
134
135 if( ! in_array( $section_id, $target_sections ) ){
136 return;
137 }
138
139 if( in_array( $widget->get_name(), array('section') ) ){
140 return;
141 }
142
143 // Adds general background options to pseudo elements
144 // ---------------------------------------------------------------------
145 $widget->start_controls_section(
146 'aux_core_common_background_pseudo',
147 array(
148 'label' => __( 'Pseudo Background (developers)', 'auxin-elements' ),
149 'tab' => Controls_Manager::TAB_ADVANCED
150 )
151 );
152
153 $widget->add_control(
154 'background_pseudo_description',
155 array(
156 'raw' => __( 'Adds background to pseudo elements like ::before and ::after selectors. (developers only)', 'auxin-elements' ),
157 'type' => Controls_Manager::RAW_HTML,
158 'content_classes' => 'elementor-descriptor'
159 )
160 );
161
162 $widget->add_control(
163 'background_pseudo_before_heading',
164 array(
165 'label' => __( 'Background ::before', 'auxin-elements' ),
166 'type' => Controls_Manager::HEADING,
167 'separator' => 'before'
168 )
169 );
170
171 $widget->add_group_control(
172 Group_Control_Background::get_type(),
173 array(
174 'name' => 'background_pseudo_before',
175 'types' => array( 'classic', 'gradient'),
176 'selector' => '{{WRAPPER}}:before'
177 )
178 );
179
180 $widget->add_control(
181 'background_pseudo_after_heading',
182 array(
183 'label' => __( 'Background ::after', 'auxin-elements' ),
184 'type' => Controls_Manager::HEADING,
185 'separator' => 'before'
186 )
187 );
188
189 $widget->add_group_control(
190 Group_Control_Background::get_type(),
191 array(
192 'name' => 'background_pseudo_after',
193 'types' => array( 'classic', 'gradient'),
194 'selector' => '{{WRAPPER}}:after'
195 )
196 );
197
198 $widget->end_controls_section();
199 }
200
201
202 /**
203 * Add parallax pro notice to advanced section
204 *
205 * @return void
206 */
207 public function add_parallax_go_pro_notice( $widget, $section_id, $args ){
208
209 if( defined('THEME_PRO') && THEME_PRO ){
210 return;
211 }
212
213 if( in_array( $widget->get_name(), array('section') ) ){
214 return;
215 }
216
217 // Anchor element sections
218 $target_sections = array('section_custom_css');
219
220 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
221 $target_sections[] = 'section_custom_css_pro';
222 }
223
224 if( ! in_array( $section_id, $target_sections ) ){
225 return;
226 }
227
228 $widget->start_controls_section(
229 'aux_pro_common_parallax_notice',
230 array(
231 'label' => __( 'Parallax', 'auxin-elements' ),
232 'tab' => Controls_Manager::TAB_ADVANCED
233 )
234 );
235
236 $widget->add_control(
237 'parallax_go_pro_notice',
238 array(
239 'type' => Controls_Manager::RAW_HTML,
240 'content_classes' => 'elementor-descriptor',
241 'raw' => '<div class="auxin-elementor-panel-notice">' .
242 '<i class="auxin-elementor-upgrade-notice-icon eicon-favorite" aria-hidden="true"></i>
243 <div class="auxin-elementor-panel-notice-title">' .
244 __( 'Parallax Effect', 'auxin-elements' ) .
245 '</div>
246 <div class="auxin-elementor-panel-notice-message">' .
247 __( 'Parallax options let you add parallax effect to any widget.', 'auxin-elements' ) .
248 '</div>
249 <div class="auxin-elementor-panel-notice-message">' .
250 __( 'This feature is only available on Phlox Pro.', 'auxin-elements' ) .
251 '</div>
252 <a class="auxin-elementor-panel-notice-link elementor-button elementor-button-default auxin-elementor-go-pro-link" href="http://phlox.pro/go-pro/?utm_source=elementor-panel&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=parallax" target="_blank">' .
253 __( 'Get Phlox Pro', 'auxin-elements' ) .
254 '</a>
255 </div>'
256 )
257 );
258
259 $widget->end_controls_section();
260 }
261
262
263 /**
264 * Add transition controls to advanced section
265 *
266 * @return void
267 */
268 public function add_transition_controls_section( $widget, $section_id, $args ){
269
270 // Anchor element sections
271 $target_sections = array('section_custom_css');
272
273 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
274 $target_sections[] = 'section_custom_css_pro';
275 }
276
277 if( ! in_array( $section_id, $target_sections ) ){
278 return;
279 }
280
281 // Adds transition options to all elements
282 // ---------------------------------------------------------------------
283 $widget->start_controls_section(
284 'aux_core_common_inview_transition',
285 array(
286 'label' => __( 'Entrance Animation', 'auxin-elements' ),
287 'tab' => Controls_Manager::TAB_ADVANCED
288 )
289 );
290
291 $widget->add_control(
292 'aux_animation_name',
293 array(
294 'label' => __( 'Animation', 'auxin-elements' ),
295 'type' => Controls_Manager::SELECT,
296 'options' => array(
297 '' => 'None',
298
299 'aux-fade-in' => 'Fade In',
300 'aux-fade-in-down' => 'Fade In Down',
301 'aux-fade-in-down-1' => 'Fade In Down 1',
302 'aux-fade-in-down-2' => 'Fade In Down 2',
303 'aux-fade-in-up' => 'Fade In Up',
304 'aux-fade-in-up-1' => 'Fade In Up 1',
305 'aux-fade-in-up-2' => 'Fade In Up 2',
306 'aux-fade-in-left' => 'Fade In Left',
307 'aux-fade-in-left-1' => 'Fade In Left 1',
308 'aux-fade-in-left-2' => 'Fade In Left 2',
309 'aux-fade-in-right' => 'Fade In Right',
310 'aux-fade-in-right-1' => 'Fade In Right 1',
311 'aux-fade-in-right-2' => 'Fade In Right 2',
312 'aux-fade-in-custom' => 'Fade In - Custom',
313
314 // Slide Animation
315 'aux-slide-from-right' => 'Slide From Right',
316 'aux-slide-from-left' => 'Slide From Left',
317 'aux-slide-from-top' => 'Slide From Top',
318 'aux-slide-from-bot' => 'Slide From Bottom',
319
320 // Mask Animation
321 'aux-mask-from-top' => 'Mask From Top',
322 'aux-mask-from-bot' => 'Mask From Bottom',
323 'aux-mask-from-left' => 'Mask From Left',
324 'aux-mask-from-right' => 'Mask From Right',
325
326 'aux-rotate-in' => 'Rotate In',
327 'aux-rotate-in-down-left' => 'Rotate In Down Left',
328 'aux-rotate-in-down-left-1' => 'Rotate In Down Left 1',
329 'aux-rotate-in-down-left-2' => 'Rotate In Down Left 2',
330 'aux-rotate-in-down-right' => 'Rotate In Down Right',
331 'aux-rotate-in-down-right-1' => 'Rotate In Down Right 1',
332 'aux-rotate-in-down-right-2' => 'Rotate In Down Right 2',
333 'aux-rotate-in-up-left' => 'Rotate In Up Left',
334 'aux-rotate-in-up-left-1' => 'Rotate In Up Left 1',
335 'aux-rotate-in-up-left-2' => 'Rotate In Up Left 2',
336 'aux-rotate-in-up-right' => 'Rotate In Up Right',
337 'aux-rotate-in-up-right-1' => 'Rotate In Up Right 1',
338 'aux-rotate-in-up-right-2' => 'Rotate In Up Right 2',
339 'aux-rotate-custom' => 'Rotate In - Custom',
340
341 'aux-zoom-in' => 'Zoom In',
342 'aux-zoom-in-1' => 'Zoom In 1',
343 'aux-zoom-in-2' => 'Zoom In 2',
344 'aux-zoom-in-3' => 'Zoom In 3',
345
346 'aux-scale-up' => 'Scale Up',
347 'aux-scale-up-1' => 'Scale Up 1',
348 'aux-scale-up-2' => 'Scale Up 2',
349
350 'aux-scale-down' => 'Scale Down',
351 'aux-scale-down-1' => 'Scale Down 1',
352 'aux-scale-down-2' => 'Scale Down 2',
353 'aux-scale-custom' => 'Scale - Custom',
354
355 'aux-flip-in-down' => 'Flip In Down',
356 'aux-flip-in-down-1' => 'Flip In Down 1',
357 'aux-flip-in-down-2' => 'Flip In Down 2',
358 'aux-flip-in-up' => 'Flip In Up',
359 'aux-flip-in-up-1' => 'Flip In Up 1',
360 'aux-flip-in-up-2' => 'Flip In Up 2',
361 'aux-flip-in-left' => 'Flip In Left',
362 'aux-flip-in-left-1' => 'Flip In Left 1',
363 'aux-flip-in-left-2' => 'Flip In Left 2',
364 'aux-flip-in-left-3' => 'Flip In Left 3',
365 'aux-flip-in-right' => 'Flip In Right',
366 'aux-flip-in-right-1' => 'Flip In Right 1',
367 'aux-flip-in-right-2' => 'Flip In Right 2',
368 'aux-flip-in-right-3' => 'Flip In Right 3',
369
370 'aux-pulse' => 'Pulse In 1' ,
371 'aux-pulse1' => 'Pulse In 2',
372 'aux-pulse2' => 'Pulse In 3',
373 'aux-pulse3' => 'Pulse In 4',
374 'aux-pulse4' => 'Pulse In 5',
375
376 'aux-pulse-out-1' => 'Pulse Out 1' ,
377 'aux-pulse-out-2' => 'Pulse Out 2' ,
378 'aux-pulse-out-3' => 'Pulse Out 3' ,
379 'aux-pulse-out-4' => 'Pulse Out 4' ,
380
381 // Specials
382 'aux-shake' => 'Shake',
383 'aux-bounce-in' => 'Bounce In',
384 'aux-jack-in-box' => 'Jack In the Box'
385 ),
386 'default' => '',
387 'prefix_class' => 'aux-appear-watch-animation ',
388 'label_block' => false
389 )
390 );
391
392 $widget->add_control(
393 'aux_fade_in_custom_x',
394 array(
395 'label' => __( 'Fade In For X', 'auxin-elements' ) . ' (px)',
396 'type' => Controls_Manager::NUMBER,
397 'default' => '',
398 'min' => -500,
399 'max' => 500,
400 'step' => 25,
401 'default' => 50,
402 'selectors' => array(
403 '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-fade-in-from-x:{{SIZE}}px;'
404 ),
405 'condition' => array(
406 'aux_animation_name' => 'aux-fade-in-custom'
407 ),
408 'render_type' => 'template'
409 )
410 );
411
412 $widget->add_control(
413 'aux_fade_in_custom_y',
414 array(
415 'label' => __( 'Fade In For Y', 'auxin-elements' ) . ' (px)',
416 'type' => Controls_Manager::NUMBER,
417 'default' => '',
418 'min' => -500,
419 'max' => 500,
420 'step' => 25,
421 'default' => 50,
422 'selectors' => array(
423 '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-fade-in-from-y:{{SIZE}}px;'
424 ),
425 'condition' => array(
426 'aux_animation_name' => 'aux-fade-in-custom'
427 ),
428 'render_type' => 'template'
429 )
430 );
431
432 $widget->add_control(
433 'aux_scale_custom',
434 array(
435 'label' => __( 'Scale', 'auxin-elements' ) . '',
436 'type' => Controls_Manager::NUMBER,
437 'default' => '',
438 'min' => 0.1,
439 'max' => 3,
440 'step' => 0.1,
441 'selectors' => array(
442 '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-scale-custom:{{SIZE}};'
443 ),
444 'condition' => array(
445 'aux_animation_name' => 'aux-scale-custom'
446 ),
447 'render_type' => 'template'
448 )
449 );
450
451 $widget->add_control(
452 'aux_rotate_custom_deg',
453 array(
454 'label' => __( 'Rotate Degree', 'auxin-elements' ) . '',
455 'type' => Controls_Manager::NUMBER,
456 'default' => '',
457 'min' => -360,
458 'max' => 360,
459 'step' => 10,
460 'selectors' => array(
461 '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-rotate-deg:{{SIZE}}deg;'
462 ),
463 'condition' => array(
464 'aux_animation_name' => 'aux-rotate-custom'
465 ),
466 'render_type' => 'template'
467 )
468 );
469
470 $widget->add_control(
471 'aux_rotate_custom_origin',
472 array(
473 'label' => __( 'Rotate Origin', 'auxin-elements' ) . '',
474 'type' => Controls_Manager::SELECT,
475 'default' => 'left bottom',
476 'options' => [
477 'left bottom' => __( 'Left Bottom', 'auxin-elements' ),
478 'right bottom' => __( 'Right Bottom', 'auxin-elements' ),
479 ],
480 'selectors' => array(
481 '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-rotate-origin:{{VALUE}};'
482 ),
483 'condition' => array(
484 'aux_animation_name' => 'aux-rotate-custom'
485 ),
486 'render_type' => 'template'
487 )
488 );
489
490 $widget->add_control(
491 'aux_animation_duration',
492 array(
493 'label' => __( 'Duration', 'auxin-elements' ) . ' (ms)',
494 'type' => Controls_Manager::NUMBER,
495 'default' => '',
496 'min' => 0,
497 'step' => 100,
498 'selectors' => array(
499 '{{WRAPPER}}' => 'animation-duration:{{SIZE}}ms;'
500 ),
501 'condition' => array(
502 'aux_animation_name!' => ''
503 ),
504 'render_type' => 'template'
505 )
506 );
507
508 $widget->add_control(
509 'aux_animation_delay',
510 array(
511 'label' => __( 'Delay', 'auxin-elements' ) . ' (ms)',
512 'type' => Controls_Manager::NUMBER,
513 'default' => '',
514 'min' => 0,
515 'step' => 100,
516 'selectors' => array(
517 '{{WRAPPER}}' => 'animation-delay:{{SIZE}}ms;'
518 ),
519 'condition' => array(
520 'aux_animation_name!' => ''
521 )
522 )
523 );
524
525 $widget->add_control(
526 'aux_animation_easing',
527 array(
528 'label' => __( 'Easing', 'auxin-elements' ),
529 'type' => Controls_Manager::SELECT,
530 'options' => array(
531 '' => 'Default',
532 'initial' => 'Initial',
533
534 'linear' => 'Linear',
535 'ease-out' => 'Ease Out',
536 '0.19,1,0.22,1' => 'Ease In Out',
537
538 '0.47,0,0.745,0.715' => 'Sine In',
539 '0.39,0.575,0.565,1' => 'Sine Out',
540 '0.445,0.05,0.55,0.95' => 'Sine In Out',
541
542 '0.55,0.085,0.68,0.53' => 'Quad In',
543 '0.25,0.46,0.45,0.94' => 'Quad Out',
544 '0.455,0.03,0.515,0.955' => 'Quad In Out',
545
546 '0.55,0.055,0.675,0.19' => 'Cubic In',
547 '0.215,0.61,0.355,1' => 'Cubic Out',
548 '0.645,0.045,0.355,1' => 'Cubic In Out',
549
550 '0.895,0.03,0.685,0.22' => 'Quart In',
551 '0.165,0.84,0.44,1' => 'Quart Out',
552 '0.77,0,0.175,1' => 'Quart In Out',
553
554 '0.895,0.03,0.685,0.22' => 'Quint In',
555 '0.895,0.03,0.685,0.22' => 'Quint Out',
556 '0.895,0.03,0.685,0.22' => 'Quint In Out',
557
558 '0.95,0.05,0.795,0.035' => 'Expo In',
559 '0.19,1,0.22,1' => 'Expo Out',
560 '1,0,0,1' => 'Expo In Out',
561
562 '0.6,0.04,0.98,0.335' => 'Circ In',
563 '0.075,0.82,0.165,1' => 'Circ Out',
564 '0.785,0.135,0.15,0.86' => 'Circ In Out',
565
566 '0.6,-0.28,0.735,0.045' => 'Back In',
567 '0.175,0.885,0.32,1.275' => 'Back Out',
568 '0.68,-0.55,0.265,1.55' => 'Back In Out'
569 ),
570 'selectors' => array(
571 '{{WRAPPER}}' => 'animation-timing-function:cubic-bezier({{VALUE}});'
572 ),
573 'condition' => array(
574 'aux_animation_name!' => ''
575 ),
576 'default' => '',
577 'return_value' => ''
578 )
579 );
580
581 $widget->add_control(
582 'aux_animation_count',
583 array(
584 'label' => __( 'Repeat Count', 'auxin-elements' ),
585 'type' => Controls_Manager::SELECT,
586 'options' => array(
587 '' => __( 'Default', 'auxin-elements' ),
588 '1' => '1',
589 '2' => '2',
590 '3' => '3',
591 '4' => '4',
592 '5' => '5',
593 'infinite' => __( 'Infinite', 'auxin-elements' )
594 ),
595 'selectors' => array(
596 '{{WRAPPER}}' => 'animation-iteration-count:{{VALUE}};opacity:1;' // opacity is required to prevent flick between repetitions
597 ),
598 'condition' => array(
599 'aux_animation_name!' => ''
600 ),
601 'default' => ''
602 )
603 );
604
605 $widget->end_controls_section();
606 }
607
608 /**
609 * Add extra controls for positioning to advanced section
610 *
611 * @return void
612 */
613 public function add_position_controls_section( $widget, $section_id, $args ){
614
615 // Anchor element sections
616 $target_sections = array('section_custom_css');
617
618 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
619 $target_sections[] = 'section_custom_css_pro';
620 }
621
622 if( ! in_array( $section_id, $target_sections ) ){
623 return;
624 }
625
626 // Adds general positioning options
627 // ---------------------------------------------------------------------
628 $widget->start_controls_section(
629 'aux_core_common_position',
630 array(
631 'label' => __( 'Positioning', 'auxin-elements' ),
632 'tab' => Controls_Manager::TAB_ADVANCED
633 )
634 );
635
636 $widget->add_responsive_control(
637 'aux_position_type',
638 array(
639 'label' => __( 'Position Type', 'auxin-elements' ),
640 'label_block' => true,
641 'type' => Controls_Manager::SELECT,
642 'options' => array(
643 '' => __( 'Default', 'auxin-elements' ),
644 'static' => __( 'Static', 'auxin-elements' ),
645 'relative' => __( 'Relative', 'auxin-elements' ),
646 'absolute' => __( 'Absolute', 'auxin-elements' )
647 ),
648 'default' => '',
649 'selectors' => array(
650 '{{WRAPPER}}' => 'position:{{VALUE}};',
651 )
652 )
653 );
654
655 $widget->add_responsive_control(
656 'aux_position_top',
657 array(
658 'label' => __('Top','auxin-elements' ),
659 'type' => Controls_Manager::SLIDER,
660 'size_units' => array('px', 'em', '%'),
661 'range' => array(
662 'px' => array(
663 'min' => -2000,
664 'max' => 2000,
665 'step' => 1
666 ),
667 '%' => array(
668 'min' => -100,
669 'max' => 100,
670 'step' => 1
671 ),
672 'em' => array(
673 'min' => -150,
674 'max' => 150,
675 'step' => 1
676 )
677 ),
678 'selectors' => array(
679 '{{WRAPPER}}' => 'top:{{SIZE}}{{UNIT}};'
680 ),
681 'condition' => array(
682 'aux_position_type' => array('relative', 'absolute')
683 )
684 )
685 );
686
687 $widget->add_responsive_control(
688 'aux_position_right',
689 array(
690 'label' => __('Right','auxin-elements' ),
691 'type' => Controls_Manager::SLIDER,
692 'size_units' => array('px', 'em', '%'),
693 'range' => array(
694 'px' => array(
695 'min' => -2000,
696 'max' => 2000,
697 'step' => 1
698 ),
699 '%' => array(
700 'min' => -100,
701 'max' => 100,
702 'step' => 1
703 ),
704 'em' => array(
705 'min' => -150,
706 'max' => 150,
707 'step' => 1
708 )
709 ),
710 'selectors' => array(
711 '{{WRAPPER}}' => 'right:{{SIZE}}{{UNIT}};'
712 ),
713 'condition' => array(
714 'aux_position_type' => array('relative', 'absolute')
715 ),
716 'return_value' => ''
717 )
718 );
719
720 $widget->add_responsive_control(
721 'aux_position_bottom',
722 array(
723 'label' => __('Bottom','auxin-elements' ),
724 'type' => Controls_Manager::SLIDER,
725 'size_units' => array('px', 'em', '%'),
726 'range' => array(
727 'px' => array(
728 'min' => -2000,
729 'max' => 2000,
730 'step' => 1
731 ),
732 '%' => array(
733 'min' => -100,
734 'max' => 100,
735 'step' => 1
736 ),
737 'em' => array(
738 'min' => -150,
739 'max' => 150,
740 'step' => 1
741 )
742 ),
743 'selectors' => array(
744 '{{WRAPPER}}' => 'bottom:{{SIZE}}{{UNIT}};'
745 ),
746 'condition' => array(
747 'aux_position_type' => array('relative', 'absolute')
748 )
749 )
750 );
751
752 $widget->add_responsive_control(
753 'aux_position_left',
754 array(
755 'label' => __('Left','auxin-elements' ),
756 'type' => Controls_Manager::SLIDER,
757 'size_units' => array('px', 'em', '%'),
758 'range' => array(
759 'px' => array(
760 'min' => -2000,
761 'max' => 2000,
762 'step' => 1
763 ),
764 '%' => array(
765 'min' => -100,
766 'max' => 100,
767 'step' => 1
768 ),
769 'em' => array(
770 'min' => -150,
771 'max' => 150,
772 'step' => 1
773 )
774 ),
775 'selectors' => array(
776 '{{WRAPPER}}' => 'left:{{SIZE}}{{UNIT}};'
777 ),
778 'condition' => array(
779 'aux_position_type' => array('relative', 'absolute')
780 )
781 )
782 );
783
784 $widget->add_responsive_control(
785 'aux_position_from_center',
786 array(
787 'label' => __('From Center','auxin-elements' ),
788 'description'=> __('Please avoid using "From Center" and "Left" options at the same time.','auxin-elements' ),
789 'type' => Controls_Manager::SLIDER,
790 'size_units' => array('px', 'em', '%'),
791 'range' => array(
792 'px' => array(
793 'min' => -1000,
794 'max' => 1000,
795 'step' => 1
796 ),
797 '%' => array(
798 'min' => -100,
799 'max' => 100,
800 'step' => 1
801 ),
802 'em' => array(
803 'min' => -150,
804 'max' => 150,
805 'step' => 1
806 )
807 ),
808 'selectors' => array(
809 '{{WRAPPER}}' => 'left:calc( 50% + {{SIZE}}{{UNIT}} );'
810 ),
811 'condition' => array(
812 'aux_position_type' => array('relative', 'absolute')
813 )
814 )
815 );
816
817 $widget->end_controls_section();
818 }
819
820
821 /**
822 * Add extra options to advanced section
823 *
824 * @return void
825 */
826 public function add_extra_controls_section( $widget, $section_id, $args ){
827
828 // Anchor element sections
829 $target_sections = array('section_custom_css');
830
831 if( ! defined('ELEMENTOR_PRO_VERSION') ) {
832 $target_sections[] = 'section_custom_css_pro';
833 }
834
835 if( ! in_array( $section_id, $target_sections ) ){
836 return;
837 }
838
839 // Adds extra options
840 // ---------------------------------------------------------------------
841 $widget->start_controls_section(
842 'aux_core_general_extra',
843 array(
844 'label' => __( 'Dimensions (extra)', 'auxin-elements' ),
845 'tab' => Controls_Manager::TAB_ADVANCED
846 )
847 );
848
849 $widget->add_responsive_control(
850 'aux_max_width',
851 [
852 'label' => __('Max Width','auxin-elements' ),
853 'type' => Controls_Manager::SLIDER,
854 'size_units' => ['px', 'em', '%', 'vw'],
855 'range' => [
856 'px' => [
857 'min' => 0,
858 'step' => 1
859 ],
860 '%' => [
861 'min' => 0,
862 'max' => 100,
863 'step' => 1
864 ],
865 'em' => [
866 'min' => 0,
867 'step' => 1
868 ],
869 'vw' => [
870 'min' => 0,
871 'max' => 100,
872 'step' => 1
873 ]
874 ],
875 'selectors' => [
876 '{{WRAPPER}}' => 'max-width:{{SIZE}}{{UNIT}};'
877 ]
878 ]
879 );
880
881 $widget->add_responsive_control(
882 'aux_max_height',
883 [
884 'label' => __('Max Height','auxin-elements' ),
885 'type' => Controls_Manager::SLIDER,
886 'size_units' => ['px', 'em', '%', 'vh'],
887 'range' => [
888 'px' => [
889 'min' => 0,
890 'step' => 1
891 ],
892 '%' => [
893 'min' => 0,
894 'max' => 100,
895 'step' => 1
896 ],
897 'em' => [
898 'min' => 0,
899 'step' => 1
900 ],
901 'vh' => [
902 'min' => 0,
903 'max' => 100,
904 'step' => 1
905 ]
906 ],
907 'selectors' => [
908 '{{WRAPPER}}' => 'max-height:{{SIZE}}{{UNIT}};'
909 ],
910 'separator' => 'after'
911 ]
912 );
913
914 $widget->add_responsive_control(
915 'aux_min_width',
916 [
917 'label' => __('Min Width','auxin-elements' ),
918 'type' => Controls_Manager::SLIDER,
919 'size_units' => ['px', 'em', '%', 'vw'],
920 'range' => [
921 'px' => [
922 'min' => 0,
923 'step' => 1
924 ],
925 '%' => [
926 'min' => 0,
927 'max' => 100,
928 'step' => 1
929 ],
930 'em' => [
931 'min' => 0,
932 'step' => 1
933 ],
934 'vw' => [
935 'min' => 0,
936 'max' => 100,
937 'step' => 1
938 ]
939 ],
940 'selectors' => [
941 '{{WRAPPER}}' => 'min-width:{{SIZE}}{{UNIT}};'
942 ]
943 ]
944 );
945
946 $widget->add_responsive_control(
947 'aux_min_height',
948 [
949 'label' => __('Min Height','auxin-elements' ),
950 'type' => Controls_Manager::SLIDER,
951 'size_units' => ['px', 'em', '%', 'vh'],
952 'range' => [
953 'px' => [
954 'min' => 0,
955 'step' => 1
956 ],
957 '%' => [
958 'min' => 0,
959 'max' => 100,
960 'step' => 1
961 ],
962 'em' => [
963 'min' => 0,
964 'step' => 1
965 ],
966 'vh' => [
967 'min' => 0,
968 'max' => 100,
969 'step' => 1
970 ]
971 ],
972 'selectors' => [
973 '{{WRAPPER}}' => 'min-height:{{SIZE}}{{UNIT}};'
974 ],
975 'separator' => 'after'
976 ]
977 );
978
979 $widget->add_responsive_control(
980 'aux_height',
981 [
982 'label' => __('Height','auxin-elements' ),
983 'type' => Controls_Manager::SLIDER,
984 'size_units' => ['px', 'em', '%', 'vh'],
985 'range' => [
986 'px' => [
987 'min' => 0,
988 'step' => 1
989 ],
990 '%' => [
991 'min' => 0,
992 'max' => 100,
993 'step' => 1
994 ],
995 'em' => [
996 'min' => 0,
997 'step' => 1
998 ],
999 'vh' => [
1000 'min' => 0,
1001 'max' => 100,
1002 'step' => 1
1003 ]
1004 ],
1005 'selectors' => [
1006 '{{WRAPPER}}' => 'height:{{SIZE}}{{UNIT}};'
1007 ]
1008 ]
1009 );
1010
1011 $widget->add_responsive_control(
1012 'flex_grow',
1013 [
1014 'label' => __( 'Grow in width', 'auxin-elements' ),
1015 'label_block' => false,
1016 'type' => Controls_Manager::NUMBER,
1017 'min' => 0,
1018 'selectors' => [
1019 '{{WRAPPER}}' => 'flex-grow: {{VALUE}};'
1020 ],
1021 'separator' => 'before'
1022 ]
1023 );
1024
1025 $widget->end_controls_section();
1026 }
1027
1028
1029 /**
1030 * Modify the render of elementor elements
1031 *
1032 * @param Widget_Base $widget Instance of Elementor Widget
1033 *
1034 * @return void
1035 */
1036 public function render_widget_attributes( $widget ){
1037 $settings = $widget->get_settings();
1038 }
1039
1040
1041 /**
1042 * Retrives the setting value or checkes whether the setting value
1043 * mathes with a value or not
1044 *
1045 * @param array $settings Settings in an array
1046 * @param string $key The setting key
1047 * @param string $value An optional value to compare with the setting value
1048 *
1049 * @return mixed Setting value or a boolean value
1050 */
1051 private function setting_value( $settings, $key, $value = null ){
1052 if( ! isset( $settings[ $key ] ) ){
1053 return;
1054 }
1055 // Retrieves the setting value
1056 if( is_null( $value ) ){
1057 return $settings[ $key ];
1058 }
1059 // Validates the setting value
1060 return ! empty( $settings[ $key ] ) && $value == $settings[ $key ];
1061 }
1062
1063 /**
1064 * Render Custom CSS for an Elementor Element
1065 *
1066 * @param $post_css Post_CSS_File
1067 * @param $element Element_Base
1068 */
1069 public function add_post_css( $post_css, $element ) {
1070 $element_settings = $element->get_settings();
1071
1072 if ( empty( $element_settings['custom_css'] ) ) {
1073 return;
1074 }
1075
1076 $css = trim( $element_settings['custom_css'] );
1077
1078 if ( empty( $css ) ) {
1079 return;
1080 }
1081 $css = str_replace( 'selector', $post_css->get_element_unique_selector( $element ), $css );
1082
1083 // Add a css comment
1084 $css = sprintf( '/* Start custom CSS for %s, class: %s */', $element->get_name(), $element->get_unique_selector() ) . $css . '/* End custom CSS */';
1085
1086 $post_css->get_stylesheet()->add_raw_css( $css );
1087 }
1088
1089 }
1090