PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.5
Elementor Website Builder – more than just a page builder v3.2.5
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 / widgets / common.php

common.php in Elementor Website Builder – more than just a page builder 3.2.5, at includes/widgets/common.php

1,049 lines 24.0 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 common widget.
10 *
11 * Elementor base widget that gives you all the advanced options of the basic
12 * widget.
13 *
14 * @since 1.0.0
15 */
16 class Widget_Common extends Widget_Base {
17
18 /**
19 * Get widget name.
20 *
21 * Retrieve common widget name.
22 *
23 * @since 1.0.0
24 * @access public
25 *
26 * @return string Widget name.
27 */
28 public function get_name() {
29 return 'common';
30 }
31
32 /**
33 * Show in panel.
34 *
35 * Whether to show the common widget in the panel or not.
36 *
37 * @since 1.0.0
38 * @access public
39 *
40 * @return bool Whether to show the widget in the panel.
41 */
42 public function show_in_panel() {
43 return false;
44 }
45
46 /**
47 * @param $shape String Shape name.
48 *
49 * @return string The shape path in the assets folder.
50 */
51 private function get_shape_url( $shape ) {
52 return ELEMENTOR_ASSETS_URL . 'mask-shapes/' . $shape . '.svg';
53 }
54
55 /**
56 * @param bool $add_custom Determine if the output should contain `Custom` options.
57 *
58 * @return array Array of shapes with their URL as key.
59 */
60 private function get_shapes( $add_custom = true ) {
61 $shapes = [
62 'circle' => __( 'Circle', 'elementor' ),
63 'flower' => __( 'Flower', 'elementor' ),
64 'sketch' => __( 'Sketch', 'elementor' ),
65 'triangle' => __( 'Triangle', 'elementor' ),
66 'blob' => __( 'Blob', 'elementor' ),
67 'hexagon' => __( 'Hexagon', 'elementor' ),
68 ];
69
70 if ( $add_custom ) {
71 $shapes['custom'] = __( 'Custom', 'elementor' );
72 }
73
74 return $shapes;
75 }
76
77 /**
78 * Get array of selectors and rules to deal with image masking and mask the image instead of the wrapper.
79 *
80 * @param $rules string The CSS rules to apply.
81 *
82 * @return array Selectors with the rules applied.
83 */
84 private function get_mask_selectors( $rules ) {
85 $mask_selectors = [
86 'default' => '{{WRAPPER}}:not( .elementor-widget-image ) .elementor-widget-container',
87 'image' => '{{WRAPPER}}.elementor-widget-image .elementor-widget-container img',
88 ];
89
90 return [
91 $mask_selectors['default'] => $rules,
92 $mask_selectors['image'] => $rules,
93 ];
94 }
95
96 /**
97 * Register common widget controls.
98 *
99 * Adds different input fields to allow the user to change and customize the widget settings.
100 *
101 * @since 3.1.0
102 * @access protected
103 */
104 protected function register_controls() {
105 $this->start_controls_section(
106 '_section_style',
107 [
108 'label' => __( 'Advanced', 'elementor' ),
109 'tab' => Controls_Manager::TAB_ADVANCED,
110 ]
111 );
112
113 // Element Name for the Navigator
114 $this->add_control(
115 '_title',
116 [
117 'label' => __( 'Title', 'elementor' ),
118 'type' => Controls_Manager::HIDDEN,
119 'render_type' => 'none',
120 ]
121 );
122
123 $this->add_responsive_control(
124 '_margin',
125 [
126 'label' => __( 'Margin', 'elementor' ),
127 'type' => Controls_Manager::DIMENSIONS,
128 'size_units' => [ 'px', 'em', '%', 'rem' ],
129 'selectors' => [
130 '{{WRAPPER}} > .elementor-widget-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
131 ],
132 ]
133 );
134
135 $this->add_responsive_control(
136 '_padding',
137 [
138 'label' => __( 'Padding', 'elementor' ),
139 'type' => Controls_Manager::DIMENSIONS,
140 'size_units' => [ 'px', 'em', '%', 'rem' ],
141 'selectors' => [
142 '{{WRAPPER}} > .elementor-widget-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
143 ],
144 ]
145 );
146
147 $this->add_responsive_control(
148 '_z_index',
149 [
150 'label' => __( 'Z-Index', 'elementor' ),
151 'type' => Controls_Manager::NUMBER,
152 'min' => 0,
153 'selectors' => [
154 '{{WRAPPER}}' => 'z-index: {{VALUE}};',
155 ],
156 'separator' => 'before',
157 ]
158 );
159
160 $this->add_control(
161 '_element_id',
162 [
163 'label' => __( 'CSS ID', 'elementor' ),
164 'type' => Controls_Manager::TEXT,
165 'dynamic' => [
166 'active' => true,
167 ],
168 'default' => '',
169 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
170 'style_transfer' => false,
171 'classes' => 'elementor-control-direction-ltr',
172 ]
173 );
174
175 $this->add_control(
176 '_css_classes',
177 [
178 'label' => __( 'CSS Classes', 'elementor' ),
179 'type' => Controls_Manager::TEXT,
180 'dynamic' => [
181 'active' => true,
182 ],
183 'prefix_class' => '',
184 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
185 'classes' => 'elementor-control-direction-ltr',
186 ]
187 );
188
189 $this->end_controls_section();
190
191 $this->start_controls_section(
192 'section_effects',
193 [
194 'label' => __( 'Motion Effects', 'elementor' ),
195 'tab' => Controls_Manager::TAB_ADVANCED,
196 ]
197 );
198
199 $this->add_responsive_control(
200 '_animation',
201 [
202 'label' => __( 'Entrance Animation', 'elementor' ),
203 'type' => Controls_Manager::ANIMATION,
204 'frontend_available' => true,
205 ]
206 );
207
208 $this->add_control(
209 'animation_duration',
210 [
211 'label' => __( 'Animation Duration', 'elementor' ),
212 'type' => Controls_Manager::SELECT,
213 'default' => '',
214 'options' => [
215 'slow' => __( 'Slow', 'elementor' ),
216 '' => __( 'Normal', 'elementor' ),
217 'fast' => __( 'Fast', 'elementor' ),
218 ],
219 'prefix_class' => 'animated-',
220 'condition' => [
221 '_animation!' => '',
222 ],
223 ]
224 );
225
226 $this->add_control(
227 '_animation_delay',
228 [
229 'label' => __( 'Animation Delay', 'elementor' ) . ' (ms)',
230 'type' => Controls_Manager::NUMBER,
231 'default' => '',
232 'min' => 0,
233 'step' => 100,
234 'condition' => [
235 '_animation!' => '',
236 ],
237 'render_type' => 'none',
238 'frontend_available' => true,
239 ]
240 );
241
242 $this->end_controls_section();
243
244 $this->start_controls_section(
245 '_section_background',
246 [
247 'label' => __( 'Background', 'elementor' ),
248 'tab' => Controls_Manager::TAB_ADVANCED,
249 ]
250 );
251
252 $this->start_controls_tabs( '_tabs_background' );
253
254 $this->start_controls_tab(
255 '_tab_background_normal',
256 [
257 'label' => __( 'Normal', 'elementor' ),
258 ]
259 );
260
261 $this->add_group_control(
262 Group_Control_Background::get_type(),
263 [
264 'name' => '_background',
265 'selector' => '{{WRAPPER}} > .elementor-widget-container',
266 ]
267 );
268
269 $this->end_controls_tab();
270
271 $this->start_controls_tab(
272 '_tab_background_hover',
273 [
274 'label' => __( 'Hover', 'elementor' ),
275 ]
276 );
277
278 $this->add_group_control(
279 Group_Control_Background::get_type(),
280 [
281 'name' => '_background_hover',
282 'selector' => '{{WRAPPER}}:hover .elementor-widget-container',
283 ]
284 );
285
286 $this->add_control(
287 '_background_hover_transition',
288 [
289 'label' => __( 'Transition Duration', 'elementor' ),
290 'type' => Controls_Manager::SLIDER,
291 'range' => [
292 'px' => [
293 'max' => 3,
294 'step' => 0.1,
295 ],
296 ],
297 'render_type' => 'ui',
298 'separator' => 'before',
299 'selectors' => [
300 '{{WRAPPER}} > .elementor-widget-container' => 'transition: background {{SIZE}}s',
301 ],
302 ]
303 );
304
305 $this->end_controls_tab();
306
307 $this->end_controls_tabs();
308
309 $this->end_controls_section();
310
311 $this->start_controls_section(
312 '_section_border',
313 [
314 'label' => __( 'Border', 'elementor' ),
315 'tab' => Controls_Manager::TAB_ADVANCED,
316 ]
317 );
318
319 $this->start_controls_tabs( '_tabs_border' );
320
321 $this->start_controls_tab(
322 '_tab_border_normal',
323 [
324 'label' => __( 'Normal', 'elementor' ),
325 ]
326 );
327
328 $this->add_group_control(
329 Group_Control_Border::get_type(),
330 [
331 'name' => '_border',
332 'selector' => '{{WRAPPER}} > .elementor-widget-container',
333 ]
334 );
335
336 $this->add_responsive_control(
337 '_border_radius',
338 [
339 'label' => __( 'Border Radius', 'elementor' ),
340 'type' => Controls_Manager::DIMENSIONS,
341 'size_units' => [ 'px', '%' ],
342 'selectors' => [
343 '{{WRAPPER}} > .elementor-widget-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
344 ],
345 ]
346 );
347
348 $this->add_group_control(
349 Group_Control_Box_Shadow::get_type(),
350 [
351 'name' => '_box_shadow',
352 'selector' => '{{WRAPPER}} > .elementor-widget-container',
353 ]
354 );
355
356 $this->end_controls_tab();
357
358 $this->start_controls_tab(
359 '_tab_border_hover',
360 [
361 'label' => __( 'Hover', 'elementor' ),
362 ]
363 );
364
365 $this->add_group_control(
366 Group_Control_Border::get_type(),
367 [
368 'name' => '_border_hover',
369 'selector' => '{{WRAPPER}}:hover .elementor-widget-container',
370 ]
371 );
372
373 $this->add_responsive_control(
374 '_border_radius_hover',
375 [
376 'label' => __( 'Border Radius', 'elementor' ),
377 'type' => Controls_Manager::DIMENSIONS,
378 'size_units' => [ 'px', '%' ],
379 'selectors' => [
380 '{{WRAPPER}}:hover > .elementor-widget-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
381 ],
382 ]
383 );
384
385 $this->add_group_control(
386 Group_Control_Box_Shadow::get_type(),
387 [
388 'name' => '_box_shadow_hover',
389 'selector' => '{{WRAPPER}}:hover .elementor-widget-container',
390 ]
391 );
392
393 $this->add_control(
394 '_border_hover_transition',
395 [
396 'label' => __( 'Transition Duration', 'elementor' ),
397 'type' => Controls_Manager::SLIDER,
398 'separator' => 'before',
399 'range' => [
400 'px' => [
401 'max' => 3,
402 'step' => 0.1,
403 ],
404 ],
405 'selectors' => [
406 '{{WRAPPER}} .elementor-widget-container' => 'transition: background {{_background_hover_transition.SIZE}}s, border {{SIZE}}s, border-radius {{SIZE}}s, box-shadow {{SIZE}}s',
407 ],
408 ]
409 );
410
411 $this->end_controls_tab();
412
413 $this->end_controls_tabs();
414
415 $this->end_controls_section();
416
417 $this->start_controls_section(
418 '_section_masking',
419 [
420 'label' => __( 'Mask', 'elementor' ),
421 'tab' => Controls_Manager::TAB_ADVANCED,
422 ]
423 );
424
425 $this->add_control(
426 '_mask_switch',
427 [
428 'label' => __( 'Mask', 'elementor' ),
429 'type' => Controls_Manager::SWITCHER,
430 'label_on' => __( 'On', 'elementor' ),
431 'label_off' => __( 'Off', 'elementor' ),
432 'default' => '',
433 ]
434 );
435
436 $this->add_control( '_mask_shape', [
437 'label' => __( 'Shape', 'elementor' ),
438 'type' => Controls_Manager::SELECT,
439 'options' => $this->get_shapes(),
440 'default' => 'circle',
441 'selectors' => $this->get_mask_selectors( '-webkit-mask-image: url( ' . ELEMENTOR_ASSETS_URL . '/mask-shapes/{{VALUE}}.svg );' ),
442 'condition' => [
443 '_mask_switch!' => '',
444 ],
445 ] );
446
447 $this->add_control(
448 '_mask_image',
449 [
450 'label' => __( 'Image', 'elementor' ),
451 'type' => Controls_Manager::MEDIA,
452 'media_type' => 'image',
453 'should_include_svg_inline_option' => true,
454 'library_type' => 'image/svg+xml',
455 'dynamic' => [
456 'active' => true,
457 ],
458 'selectors' => $this->get_mask_selectors( '-webkit-mask-image: url( {{URL}} );' ),
459 'condition' => [
460 '_mask_switch!' => '',
461 '_mask_shape' => 'custom',
462 ],
463 ]
464 );
465
466 $this->add_control(
467 '_mask_notice',
468 [
469 'type' => Controls_Manager::HIDDEN,
470 'raw' => __( 'Need More Shapes?', 'elementor' ) . '<br>' . sprintf( __( 'Explore additional Premium Shape packs and use them in your site. <a target="_blank" href="%s">Learn More</a>', 'elementor' ), 'https://go.elementor.com/mask-control' ),
471 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
472 'condition' => [
473 '_mask_switch!' => '',
474 ],
475 ]
476 );
477
478 $this->add_responsive_control(
479 '_mask_size',
480 [
481 'label' => __( 'Size', 'elementor' ),
482 'type' => Controls_Manager::SELECT,
483 'options' => [
484 'contain' => __( 'Fit', 'elementor' ),
485 'cover' => __( 'Fill', 'elementor' ),
486 'custom' => __( 'Custom', 'elementor' ),
487 ],
488 'default' => 'contain',
489 'selectors' => $this->get_mask_selectors( '-webkit-mask-size: {{VALUE}};' ),
490 'condition' => [
491 '_mask_switch!' => '',
492 ],
493 ]
494 );
495
496 $this->add_responsive_control(
497 '_mask_size_scale',
498 [
499 'label' => __( 'Scale', 'elementor' ),
500 'type' => Controls_Manager::SLIDER,
501 'size_units' => [ 'px', 'em', '%', 'vw' ],
502 'range' => [
503 'px' => [
504 'min' => 0,
505 'max' => 500,
506 ],
507 'em' => [
508 'min' => 0,
509 'max' => 100,
510 ],
511 '%' => [
512 'min' => 0,
513 'max' => 200,
514 ],
515 'vw' => [
516 'min' => 0,
517 'max' => 100,
518 ],
519 ],
520 'default' => [
521 'unit' => '%',
522 'size' => 100,
523 ],
524 'selectors' => $this->get_mask_selectors( '-webkit-mask-size: {{SIZE}}{{UNIT}};' ),
525 'condition' => [
526 '_mask_switch!' => '',
527 '_mask_size' => 'custom',
528 ],
529 ]
530 );
531
532 $this->add_responsive_control(
533 '_mask_position',
534 [
535 'label' => __( 'Position', 'elementor' ),
536 'type' => Controls_Manager::SELECT,
537 'options' => [
538 'center center' => __( 'Center Center', 'elementor' ),
539 'center left' => __( 'Center Left', 'elementor' ),
540 'center right' => __( 'Center Right', 'elementor' ),
541 'top center' => __( 'Top Center', 'elementor' ),
542 'top left' => __( 'Top Left', 'elementor' ),
543 'top right' => __( 'Top Right', 'elementor' ),
544 'bottom center' => __( 'Bottom Center', 'elementor' ),
545 'bottom left' => __( 'Bottom Left', 'elementor' ),
546 'bottom right' => __( 'Bottom Right', 'elementor' ),
547 'custom' => __( 'Custom', 'elementor' ),
548 ],
549 'default' => 'center center',
550 'selectors' => $this->get_mask_selectors( '-webkit-mask-position: {{VALUE}};' ),
551 'condition' => [
552 '_mask_switch!' => '',
553 ],
554 ]
555 );
556
557 $this->add_responsive_control(
558 '_mask_position_x',
559 [
560 'label' => __( 'X Position', 'elementor' ),
561 'type' => Controls_Manager::SLIDER,
562 'size_units' => [ 'px', 'em', '%', 'vw' ],
563 'range' => [
564 'px' => [
565 'min' => -500,
566 'max' => 500,
567 ],
568 'em' => [
569 'min' => -100,
570 'max' => 100,
571 ],
572 '%' => [
573 'min' => -100,
574 'max' => 100,
575 ],
576 'vw' => [
577 'min' => -100,
578 'max' => 100,
579 ],
580 ],
581 'default' => [
582 'unit' => '%',
583 'size' => 0,
584 ],
585 'selectors' => $this->get_mask_selectors( '-webkit-mask-position-x: {{SIZE}}{{UNIT}};' ),
586 'condition' => [
587 '_mask_switch!' => '',
588 '_mask_position' => 'custom',
589 ],
590 ]
591 );
592
593 $this->add_responsive_control(
594 '_mask_position_y',
595 [
596 'label' => __( 'Y Position', 'elementor' ),
597 'type' => Controls_Manager::SLIDER,
598 'size_units' => [ 'px', 'em', '%', 'vw' ],
599 'range' => [
600 'px' => [
601 'min' => -500,
602 'max' => 500,
603 ],
604 'em' => [
605 'min' => -100,
606 'max' => 100,
607 ],
608 '%' => [
609 'min' => -100,
610 'max' => 100,
611 ],
612 'vw' => [
613 'min' => -100,
614 'max' => 100,
615 ],
616 ],
617 'default' => [
618 'unit' => '%',
619 'size' => 0,
620 ],
621 'selectors' => $this->get_mask_selectors( '-webkit-mask-position-y: {{SIZE}}{{UNIT}};' ),
622 'condition' => [
623 '_mask_switch!' => '',
624 '_mask_position' => 'custom',
625 ],
626 ]
627 );
628
629 $this->add_responsive_control(
630 '_mask_repeat',
631 [
632 'label' => __( 'Repeat', 'elementor' ),
633 'type' => Controls_Manager::SELECT,
634 'options' => [
635 'no-repeat' => __( 'No-Repeat', 'elementor' ),
636 'repeat' => __( 'Repeat', 'elementor' ),
637 'repeat-x' => __( 'Repeat-X', 'elementor' ),
638 'repeat-Y' => __( 'Repeat-Y', 'elementor' ),
639 'round' => __( 'Round', 'elementor' ),
640 'space' => __( 'Space', 'elementor' ),
641 ],
642 'default' => 'no-repeat',
643 'selectors' => $this->get_mask_selectors( '-webkit-mask-repeat: {{VALUE}};' ),
644 'condition' => [
645 '_mask_switch!' => '',
646 '_mask_size!' => 'cover',
647 ],
648 ]
649 );
650
651 $this->end_controls_section();
652
653 $this->start_controls_section(
654 '_section_position',
655 [
656 'label' => __( 'Positioning', 'elementor' ),
657 'tab' => Controls_Manager::TAB_ADVANCED,
658 ]
659 );
660
661 $this->add_responsive_control(
662 '_element_width',
663 [
664 'label' => __( 'Width', 'elementor' ),
665 'type' => Controls_Manager::SELECT,
666 'default' => '',
667 'options' => [
668 '' => __( 'Default', 'elementor' ),
669 'inherit' => __( 'Full Width', 'elementor' ) . ' (100%)',
670 'auto' => __( 'Inline', 'elementor' ) . ' (auto)',
671 'initial' => __( 'Custom', 'elementor' ),
672 ],
673 'selectors_dictionary' => [
674 'inherit' => '100%',
675 ],
676 'prefix_class' => 'elementor-widget%s__width-',
677 'selectors' => [
678 '{{WRAPPER}}' => 'width: {{VALUE}}; max-width: {{VALUE}}',
679 ],
680 ]
681 );
682
683 $this->add_responsive_control(
684 '_element_custom_width',
685 [
686 'label' => __( 'Custom Width', 'elementor' ),
687 'type' => Controls_Manager::SLIDER,
688 'range' => [
689 'px' => [
690 'max' => 1000,
691 'step' => 1,
692 ],
693 '%' => [
694 'max' => 100,
695 'step' => 1,
696 ],
697 ],
698 'condition' => [
699 '_element_width' => 'initial',
700 ],
701 'device_args' => [
702 Controls_Stack::RESPONSIVE_TABLET => [
703 'condition' => [
704 '_element_width_tablet' => [ 'initial' ],
705 ],
706 ],
707 Controls_Stack::RESPONSIVE_MOBILE => [
708 'condition' => [
709 '_element_width_mobile' => [ 'initial' ],
710 ],
711 ],
712 ],
713 'size_units' => [ 'px', '%', 'vw' ],
714 'selectors' => [
715 '{{WRAPPER}}' => 'width: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}}',
716 ],
717 ]
718 );
719
720 $this->add_responsive_control(
721 '_element_vertical_align',
722 [
723 'label' => __( 'Vertical Align', 'elementor' ),
724 'type' => Controls_Manager::CHOOSE,
725 'options' => [
726 'flex-start' => [
727 'title' => __( 'Start', 'elementor' ),
728 'icon' => 'eicon-v-align-top',
729 ],
730 'center' => [
731 'title' => __( 'Center', 'elementor' ),
732 'icon' => 'eicon-v-align-middle',
733 ],
734 'flex-end' => [
735 'title' => __( 'End', 'elementor' ),
736 'icon' => 'eicon-v-align-bottom',
737 ],
738 ],
739 'condition' => [
740 '_element_width!' => '',
741 '_position' => '',
742 ],
743 'selectors' => [
744 '{{WRAPPER}}' => 'align-self: {{VALUE}}',
745 ],
746 ]
747 );
748
749 $this->add_control(
750 '_position_description',
751 [
752 'raw' => '<strong>' . __( 'Please note!', 'elementor' ) . '</strong> ' . __( 'Custom positioning is not considered best practice for responsive web design and should not be used too frequently.', 'elementor' ),
753 'type' => Controls_Manager::RAW_HTML,
754 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
755 'render_type' => 'ui',
756 'condition' => [
757 '_position!' => '',
758 ],
759 ]
760 );
761
762 $this->add_control(
763 '_position',
764 [
765 'label' => __( 'Position', 'elementor' ),
766 'type' => Controls_Manager::SELECT,
767 'default' => '',
768 'options' => [
769 '' => __( 'Default', 'elementor' ),
770 'absolute' => __( 'Absolute', 'elementor' ),
771 'fixed' => __( 'Fixed', 'elementor' ),
772 ],
773 'prefix_class' => 'elementor-',
774 'frontend_available' => true,
775 ]
776 );
777
778 $start = is_rtl() ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' );
779 $end = ! is_rtl() ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' );
780
781 $this->add_control(
782 '_offset_orientation_h',
783 [
784 'label' => __( 'Horizontal Orientation', 'elementor' ),
785 'type' => Controls_Manager::CHOOSE,
786 'toggle' => false,
787 'default' => 'start',
788 'options' => [
789 'start' => [
790 'title' => $start,
791 'icon' => 'eicon-h-align-left',
792 ],
793 'end' => [
794 'title' => $end,
795 'icon' => 'eicon-h-align-right',
796 ],
797 ],
798 'classes' => 'elementor-control-start-end',
799 'render_type' => 'ui',
800 'condition' => [
801 '_position!' => '',
802 ],
803 ]
804 );
805
806 $this->add_responsive_control(
807 '_offset_x',
808 [
809 'label' => __( 'Offset', 'elementor' ),
810 'type' => Controls_Manager::SLIDER,
811 'range' => [
812 'px' => [
813 'min' => -1000,
814 'max' => 1000,
815 'step' => 1,
816 ],
817 '%' => [
818 'min' => -200,
819 'max' => 200,
820 ],
821 'vw' => [
822 'min' => -200,
823 'max' => 200,
824 ],
825 'vh' => [
826 'min' => -200,
827 'max' => 200,
828 ],
829 ],
830 'default' => [
831 'size' => '0',
832 ],
833 'size_units' => [ 'px', '%', 'vw', 'vh' ],
834 'selectors' => [
835 'body:not(.rtl) {{WRAPPER}}' => 'left: {{SIZE}}{{UNIT}}',
836 'body.rtl {{WRAPPER}}' => 'right: {{SIZE}}{{UNIT}}',
837 ],
838 'condition' => [
839 '_offset_orientation_h!' => 'end',
840 '_position!' => '',
841 ],
842 ]
843 );
844
845 $this->add_responsive_control(
846 '_offset_x_end',
847 [
848 'label' => __( 'Offset', 'elementor' ),
849 'type' => Controls_Manager::SLIDER,
850 'range' => [
851 'px' => [
852 'min' => -1000,
853 'max' => 1000,
854 'step' => 0.1,
855 ],
856 '%' => [
857 'min' => -200,
858 'max' => 200,
859 ],
860 'vw' => [
861 'min' => -200,
862 'max' => 200,
863 ],
864 'vh' => [
865 'min' => -200,
866 'max' => 200,
867 ],
868 ],
869 'default' => [
870 'size' => '0',
871 ],
872 'size_units' => [ 'px', '%', 'vw', 'vh' ],
873 'selectors' => [
874 'body:not(.rtl) {{WRAPPER}}' => 'right: {{SIZE}}{{UNIT}}',
875 'body.rtl {{WRAPPER}}' => 'left: {{SIZE}}{{UNIT}}',
876 ],
877 'condition' => [
878 '_offset_orientation_h' => 'end',
879 '_position!' => '',
880 ],
881 ]
882 );
883
884 $this->add_control(
885 '_offset_orientation_v',
886 [
887 'label' => __( 'Vertical Orientation', 'elementor' ),
888 'type' => Controls_Manager::CHOOSE,
889 'toggle' => false,
890 'default' => 'start',
891 'options' => [
892 'start' => [
893 'title' => __( 'Top', 'elementor' ),
894 'icon' => 'eicon-v-align-top',
895 ],
896 'end' => [
897 'title' => __( 'Bottom', 'elementor' ),
898 'icon' => 'eicon-v-align-bottom',
899 ],
900 ],
901 'render_type' => 'ui',
902 'condition' => [
903 '_position!' => '',
904 ],
905 ]
906 );
907
908 $this->add_responsive_control(
909 '_offset_y',
910 [
911 'label' => __( 'Offset', 'elementor' ),
912 'type' => Controls_Manager::SLIDER,
913 'range' => [
914 'px' => [
915 'min' => -1000,
916 'max' => 1000,
917 'step' => 1,
918 ],
919 '%' => [
920 'min' => -200,
921 'max' => 200,
922 ],
923 'vh' => [
924 'min' => -200,
925 'max' => 200,
926 ],
927 'vw' => [
928 'min' => -200,
929 'max' => 200,
930 ],
931 ],
932 'size_units' => [ 'px', '%', 'vh', 'vw' ],
933 'default' => [
934 'size' => '0',
935 ],
936 'selectors' => [
937 '{{WRAPPER}}' => 'top: {{SIZE}}{{UNIT}}',
938 ],
939 'condition' => [
940 '_offset_orientation_v!' => 'end',
941 '_position!' => '',
942 ],
943 ]
944 );
945
946 $this->add_responsive_control(
947 '_offset_y_end',
948 [
949 'label' => __( 'Offset', 'elementor' ),
950 'type' => Controls_Manager::SLIDER,
951 'range' => [
952 'px' => [
953 'min' => -1000,
954 'max' => 1000,
955 'step' => 1,
956 ],
957 '%' => [
958 'min' => -200,
959 'max' => 200,
960 ],
961 'vh' => [
962 'min' => -200,
963 'max' => 200,
964 ],
965 'vw' => [
966 'min' => -200,
967 'max' => 200,
968 ],
969 ],
970 'size_units' => [ 'px', '%', 'vh', 'vw' ],
971 'default' => [
972 'size' => '0',
973 ],
974 'selectors' => [
975 '{{WRAPPER}}' => 'bottom: {{SIZE}}{{UNIT}}',
976 ],
977 'condition' => [
978 '_offset_orientation_v' => 'end',
979 '_position!' => '',
980 ],
981 ]
982 );
983
984 $this->end_controls_section();
985
986 $this->start_controls_section(
987 '_section_responsive',
988 [
989 'label' => __( 'Responsive', 'elementor' ),
990 'tab' => Controls_Manager::TAB_ADVANCED,
991 ]
992 );
993
994 $this->add_control(
995 'responsive_description',
996 [
997 'raw' => __( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ),
998 'type' => Controls_Manager::RAW_HTML,
999 'content_classes' => 'elementor-descriptor',
1000 ]
1001 );
1002
1003 $this->add_control(
1004 'hide_desktop',
1005 [
1006 'label' => __( 'Hide On Desktop', 'elementor' ),
1007 'type' => Controls_Manager::SWITCHER,
1008 'default' => '',
1009 'prefix_class' => 'elementor-',
1010 'label_on' => 'Hide',
1011 'label_off' => 'Show',
1012 'return_value' => 'hidden-desktop',
1013 ]
1014 );
1015
1016 $this->add_control(
1017 'hide_tablet',
1018 [
1019 'label' => __( 'Hide On Tablet', 'elementor' ),
1020 'type' => Controls_Manager::SWITCHER,
1021 'default' => '',
1022 'prefix_class' => 'elementor-',
1023 'label_on' => 'Hide',
1024 'label_off' => 'Show',
1025 'return_value' => 'hidden-tablet',
1026 ]
1027 );
1028
1029 $this->add_control(
1030 'hide_mobile',
1031 [
1032 'label' => __( 'Hide On Mobile', 'elementor' ),
1033 'type' => Controls_Manager::SWITCHER,
1034 'default' => '',
1035 'prefix_class' => 'elementor-',
1036 'label_on' => 'Hide',
1037 'label_off' => 'Show',
1038 'return_value' => 'hidden-phone',
1039 ]
1040 );
1041
1042 $this->end_controls_section();
1043
1044 Plugin::$instance->controls_manager->add_custom_attributes_controls( $this );
1045
1046 Plugin::$instance->controls_manager->add_custom_css_controls( $this );
1047 }
1048 }
1049