PluginProbe
Elementor Website Builder – more than just a page builder / 3.24.7
Elementor Website Builder – more than just a page builder v3.24.7
4.3.0-beta3 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 All 452 releases
elementor / modules / floating-buttons / base / widget-floating-bars-base.php

widget-floating-bars-base.php in Elementor Website Builder – more than just a page builder 3.24.7, at modules/floating-buttons/base/widget-floating-bars-base.php

1,537 lines 37.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\FloatingButtons\Base;
3
4 use Elementor\Modules\FloatingButtons\Classes\Render\Floating_Bars_Core_Render;
5 use Elementor\Core\Base\Providers\Social_Network_Provider;
6
7 use Elementor\Group_Control_Background;
8 use Elementor\Group_Control_Typography;
9
10 use Elementor\Plugin;
11 use Elementor\Repeater;
12 use Elementor\Controls_Manager;
13 use Elementor\Widget_Base;
14
15 abstract class Widget_Floating_Bars_Base extends Widget_Base {
16
17 const TAB_ADVANCED = 'advanced-tab-floating-bars';
18
19 public function get_icon(): string {
20 return 'eicon-banner';
21 }
22
23 public function show_in_panel() {
24 return false;
25 }
26
27 public function hide_on_search() {
28 return true;
29 }
30
31 protected function get_initial_config(): array {
32 return array_merge( parent::get_initial_config(), [
33 'commonMerged' => true,
34 ] );
35 }
36
37 public static function get_configuration() {
38 return [
39 'content' => [
40 'announcement_section' => [
41 'icon_default' => [
42 'value' => 'fas fa-tshirt',
43 'library' => 'fa-solid',
44 ],
45 'text_label' => esc_html__( 'Text', 'elementor' ),
46 'text_default' => esc_html__( 'Just in! Cool summer tees', 'elementor' ),
47 ],
48 'floating_bar_section' => [
49 'close_switch_default' => 'yes',
50 'has_pause_switch' => false,
51 'accessible_name_default' => esc_html__( 'Banner', 'elementor' ),
52 ],
53 ],
54 'style' => [
55 'floating_bar_section' => [
56 'has_close_bg' => false,
57 'close_position_selectors' => [
58 '{{WRAPPER}} .e-floating-bars__close-button' => 'inset-inline-{{VALUE}}: 10px;',
59 ],
60 'has_close_position_control' => true,
61 'background_selector' => '{{WRAPPER}} .e-floating-bars',
62 'align_elements_selector' => [
63 '{{WRAPPER}} .e-floating-bars' => 'justify-content: {{VALUE}};',
64 '{{WRAPPER}} .e-floating-bars__cta-button-container' => 'justify-content: {{VALUE}};',
65 '{{WRAPPER}} .e-floating-bars__announcement-text' => 'text-align: {{VALUE}};',
66 ],
67 ],
68 ],
69 'advanced' => [],
70 ];
71 }
72
73 protected function register_controls(): void {
74 $this->add_content_tab();
75
76 $this->add_style_tab();
77
78 $this->add_advanced_tab();
79 }
80
81 protected function add_announcement_content_section(): void {
82 $config = static::get_configuration();
83
84 $this->start_controls_section(
85 'announcement_content_section',
86 [
87 'label' => __( 'Announcement', 'elementor' ),
88 'tab' => Controls_Manager::TAB_CONTENT,
89 ]
90 );
91
92 $this->add_control(
93 'announcement_icon',
94 [
95 'label' => esc_html__( 'Icon', 'elementor' ),
96 'type' => Controls_Manager::ICONS,
97 'fa4compatibility' => 'icon',
98 'default' => $config['content']['announcement_section']['icon_default'],
99 'skin' => 'inline',
100 'label_block' => false,
101 'icon_exclude_inline_options' => [],
102 ]
103 );
104
105 $this->add_control(
106 'announcement_text',
107 [
108 'label' => $config['content']['announcement_section']['text_label'],
109 'type' => Controls_Manager::TEXTAREA,
110 'dynamic' => [
111 'active' => true,
112 ],
113 'placeholder' => esc_html__( 'Enter your text here', 'elementor' ),
114 'default' => $config['content']['announcement_section']['text_default'],
115 ]
116 );
117
118 $this->end_controls_section();
119 }
120
121 protected function add_cta_button_content_section(): void {
122 $this->start_controls_section(
123 'cta_button_content_section',
124 [
125 'label' => __( 'CTA Button', 'elementor' ),
126 'tab' => Controls_Manager::TAB_CONTENT,
127 ]
128 );
129
130 $this->add_control(
131 'cta_text',
132 [
133 'label' => esc_html__( 'Text', 'elementor' ),
134 'type' => Controls_Manager::TEXT,
135 'dynamic' => [
136 'active' => true,
137 ],
138 'placeholder' => esc_html__( 'Enter text', 'elementor' ),
139 'default' => esc_html__( 'Shop now', 'elementor' ),
140 ],
141 );
142
143 $this->add_control(
144 'cta_link',
145 [
146 'label' => esc_html__( 'Link', 'elementor' ),
147 'type' => Controls_Manager::URL,
148 'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ),
149 'dynamic' => [
150 'active' => true,
151 ],
152 'default' => [
153 'url' => '',
154 'is_external' => true,
155 'nofollow' => false,
156 ],
157 ]
158 );
159
160 $this->add_control(
161 'cta_icon',
162 [
163 'label' => esc_html__( 'Icon', 'elementor' ),
164 'type' => Controls_Manager::ICONS,
165 'fa4compatibility' => 'icon',
166 'skin' => 'inline',
167 'label_block' => false,
168 'icon_exclude_inline_options' => [],
169 ]
170 );
171
172 $this->end_controls_section();
173 }
174
175 protected function add_accessible_name_control(): void {
176 $config = static::get_configuration();
177
178 $this->add_control(
179 'accessible_name',
180 [
181 'label' => esc_html__( 'Accessible Name', 'elementor' ),
182 'type' => Controls_Manager::TEXT,
183 'dynamic' => [
184 'active' => true,
185 ],
186 'placeholder' => esc_html__( 'Enter text', 'elementor' ),
187 'default' => $config['content']['floating_bar_section']['accessible_name_default'],
188 'condition' => [
189 'floating_bar_close_switch' => 'yes',
190 ],
191 ],
192 );
193 }
194
195 protected function add_floating_bar_content_section(): void {
196 $config = static::get_configuration();
197
198 $this->start_controls_section(
199 'floating_bar_content_section',
200 [
201 'label' => __( 'Floating Bar', 'elementor' ),
202 'tab' => Controls_Manager::TAB_CONTENT,
203 ]
204 );
205
206 if ( $config['content']['floating_bar_section']['has_pause_switch'] ) {
207 $this->add_control(
208 'floating_bar_pause_switch',
209 [
210 'label' => esc_html__( 'Pause and Play', 'elementor' ),
211 'type' => Controls_Manager::SWITCHER,
212 'label_on' => esc_html__( 'Show', 'elementor' ),
213 'label_off' => esc_html__( 'Hide', 'elementor' ),
214 'return_value' => 'yes',
215 'default' => 'no',
216 ]
217 );
218
219 $this->add_control(
220 'floating_bar_pause_icon',
221 [
222 'label' => esc_html__( 'Pause Icon', 'elementor' ),
223 'type' => Controls_Manager::ICONS,
224 'fa4compatibility' => 'icon',
225 'default' => [
226 'value' => 'fas fa-pause',
227 'library' => 'fa-solid',
228 ],
229 'skin' => 'inline',
230 'label_block' => false,
231 'exclude_inline_options' => [ 'none' ],
232 'recommended' => [
233 'fa-regular' => [
234 'pause-circle',
235 ],
236 'fa-solid' => [
237 'pause-circle',
238 ],
239 ],
240 'condition' => [
241 'floating_bar_pause_switch' => 'yes',
242 ],
243 ],
244 );
245
246 $this->add_control(
247 'floating_bar_play_icon',
248 [
249 'label' => esc_html__( 'Play Icon', 'elementor' ),
250 'type' => Controls_Manager::ICONS,
251 'fa4compatibility' => 'icon',
252 'default' => [
253 'value' => 'fas fa-play',
254 'library' => 'fa-solid',
255 ],
256 'skin' => 'inline',
257 'label_block' => false,
258 'exclude_inline_options' => [ 'none' ],
259 'recommended' => [
260 'fa-regular' => [
261 'play-circle',
262 ],
263 'fa-solid' => [
264 'play-circle',
265 ],
266 ],
267 'condition' => [
268 'floating_bar_pause_switch' => 'yes',
269 ],
270 ],
271 );
272 }
273
274 $this->add_control(
275 'floating_bar_close_switch',
276 [
277 'label' => esc_html__( 'Close Button', 'elementor' ),
278 'type' => Controls_Manager::SWITCHER,
279 'label_on' => esc_html__( 'Show', 'elementor' ),
280 'label_off' => esc_html__( 'Hide', 'elementor' ),
281 'return_value' => 'yes',
282 'default' => $config['content']['floating_bar_section']['close_switch_default'],
283 ]
284 );
285
286 $this->add_accessible_name_control();
287
288 $this->end_controls_section();
289 }
290
291 protected function add_headlines_content_section(): void {
292 $config = static::get_configuration();
293
294 $this->start_controls_section(
295 'headlines_content',
296 [
297 'label' => esc_html__( 'Headlines', 'elementor' ),
298 'tab' => Controls_Manager::TAB_CONTENT,
299 ]
300 );
301
302 $repeater = new Repeater();
303
304 $repeater->add_control(
305 'headlines_icon',
306 [
307 'label' => esc_html__( 'Icon', 'elementor' ),
308 'type' => Controls_Manager::ICONS,
309 'fa4compatibility' => 'icon',
310 'skin' => 'inline',
311 'label_block' => false,
312 'icon_exclude_inline_options' => [],
313 ]
314 );
315
316 $repeater->add_control(
317 'headlines_text',
318 [
319 'label' => esc_html__( 'Text', 'elementor' ),
320 'type' => Controls_Manager::TEXTAREA,
321 'placeholder' => esc_html__( 'Enter your text', 'elementor' ),
322 'default' => esc_html__( 'Item Title', 'elementor' ),
323 'dynamic' => [
324 'active' => true,
325 ],
326 ]
327 );
328
329 $repeater->add_control(
330 'headlines_url',
331 [
332 'label' => esc_html__( 'Link', 'elementor' ),
333 'type' => Controls_Manager::URL,
334 'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ),
335 'dynamic' => [
336 'active' => true,
337 ],
338 'frontend_available' => true,
339 ]
340 );
341
342 $this->add_control(
343 'headlines_repeater',
344 [
345 'type' => Controls_Manager::REPEATER,
346 'fields' => $repeater->get_controls(),
347 'title_field' => '{{{ headlines_text }}}',
348 'prevent_empty' => true,
349 'button_text' => esc_html__( 'Add Item', 'elementor' ),
350 'default' => [
351 [
352 'headlines_text' => esc_html__( 'Item #1', 'elementor' ),
353 ],
354 [
355 'headlines_text' => esc_html__( 'Item #2', 'elementor' ),
356 ],
357 [
358 'headlines_text' => esc_html__( 'Item #3', 'elementor' ),
359 ],
360 ],
361 ]
362 );
363
364 $this->end_controls_section();
365 }
366
367 protected function add_announcement_style_section(): void {
368 $config = static::get_configuration();
369
370 $this->start_controls_section(
371 'style_announcement',
372 [
373 'label' => esc_html__( 'Announcement', 'elementor' ),
374 'tab' => Controls_Manager::TAB_STYLE,
375 ]
376 );
377
378 $this->add_control(
379 'style_announcement_icon_heading',
380 [
381 'label' => esc_html__( 'Icon', 'elementor' ),
382 'type' => Controls_Manager::HEADING,
383 'conditions' => [
384 'relation' => 'and',
385 'terms' => [
386 [
387 'name' => 'announcement_icon[value]',
388 'operator' => '!==',
389 'value' => '',
390 ],
391 [
392 'name' => 'announcement_icon[value]',
393 'operator' => '!==',
394 'value' => null,
395 ],
396 ],
397 ],
398 ]
399 );
400
401 $this->add_control(
402 'style_announcement_icon_color',
403 [
404 'label' => esc_html__( 'Color', 'elementor' ),
405 'type' => Controls_Manager::COLOR,
406 'selectors' => [
407 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-announcement-icon-color: {{VALUE}}',
408 ],
409 'conditions' => [
410 'relation' => 'and',
411 'terms' => [
412 [
413 'name' => 'announcement_icon[value]',
414 'operator' => '!==',
415 'value' => '',
416 ],
417 [
418 'name' => 'announcement_icon[value]',
419 'operator' => '!==',
420 'value' => null,
421 ],
422 ],
423 ],
424 ]
425 );
426
427 $this->add_responsive_control(
428 'style_announcement_icon_position',
429 [
430 'label' => esc_html__( 'Position', 'elementor' ),
431 'type' => Controls_Manager::CHOOSE,
432 'options' => [
433 'start' => [
434 'title' => esc_html__( 'Left', 'elementor' ),
435 'icon' => 'eicon-h-align-left',
436 ],
437 'end' => [
438 'title' => esc_html__( 'Right', 'elementor' ),
439 'icon' => 'eicon-h-align-right',
440 ],
441 ],
442 'selectors' => [
443 '{{WRAPPER}} .e-floating-bars__announcement-icon' => 'order: {{VALUE}};',
444 ],
445 'selectors_dictionary' => [
446 'start' => '-1',
447 'end' => '2',
448 ],
449 'default' => 'start',
450 'toggle' => false,
451 'conditions' => [
452 'relation' => 'and',
453 'terms' => [
454 [
455 'name' => 'announcement_icon[value]',
456 'operator' => '!==',
457 'value' => '',
458 ],
459 [
460 'name' => 'announcement_icon[value]',
461 'operator' => '!==',
462 'value' => null,
463 ],
464 ],
465 ],
466 ]
467 );
468
469 $this->add_responsive_control(
470 'style_announcement_icon_size',
471 [
472 'label' => esc_html__( 'Size', 'elementor' ),
473 'type' => Controls_Manager::SLIDER,
474 'range' => [
475 'px' => [
476 'min' => 0,
477 'max' => 150,
478 ],
479 ],
480 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
481 'selectors' => [
482 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-announcement-icon-size: {{SIZE}}{{UNIT}}',
483 ],
484 'separator' => 'after',
485 'conditions' => [
486 'relation' => 'and',
487 'terms' => [
488 [
489 'name' => 'announcement_icon[value]',
490 'operator' => '!==',
491 'value' => '',
492 ],
493 [
494 'name' => 'announcement_icon[value]',
495 'operator' => '!==',
496 'value' => null,
497 ],
498 ],
499 ],
500 ]
501 );
502
503 $this->add_control(
504 'style_announcement_text_heading',
505 [
506 'label' => $config['content']['announcement_section']['text_label'],
507 'type' => Controls_Manager::HEADING,
508 ]
509 );
510
511 $this->add_group_control(
512 Group_Control_Typography::get_type(),
513 [
514 'name' => 'style_announcement_text_typography',
515 'selector' => '{{WRAPPER}} .e-floating-bars__announcement-text',
516 ]
517 );
518
519 $this->add_control(
520 'style_announcement_text_color',
521 [
522 'label' => esc_html__( 'Color', 'elementor' ),
523 'type' => Controls_Manager::COLOR,
524 'selectors' => [
525 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-announcement-text-color: {{VALUE}}',
526 ],
527 ]
528 );
529
530 $this->end_controls_section();
531 }
532
533 protected function add_cta_button_style_section(): void {
534 $this->start_controls_section(
535 'style_cta_button',
536 [
537 'label' => esc_html__( 'CTA Button', 'elementor' ),
538 'tab' => Controls_Manager::TAB_STYLE,
539 ]
540 );
541
542 $this->add_control(
543 'style_cta_type',
544 [
545 'label' => esc_html__( 'Type', 'elementor' ),
546 'type' => Controls_Manager::SELECT,
547 'default' => 'button',
548 'options' => [
549 'button' => esc_html__( 'Button', 'elementor' ),
550 'link' => esc_html__( 'Link', 'elementor' ),
551 ],
552 ]
553 );
554
555 $this->add_responsive_control(
556 'style_cta_icon_position',
557 [
558 'label' => esc_html__( 'Icon Position', 'elementor' ),
559 'type' => Controls_Manager::CHOOSE,
560 'default' => is_rtl() ? 'row-reverse' : 'row',
561 'toggle' => false,
562 'options' => [
563 'row' => [
564 'title' => esc_html__( 'Start', 'elementor' ),
565 'icon' => 'eicon-h-align-left',
566 ],
567 'row-reverse' => [
568 'title' => esc_html__( 'End', 'elementor' ),
569 'icon' => 'eicon-h-align-right',
570 ],
571 ],
572 'selectors_dictionary' => [
573 'left' => is_rtl() ? 'row-reverse' : 'row',
574 'right' => is_rtl() ? 'row' : 'row-reverse',
575 ],
576 'selectors' => [
577 '{{WRAPPER}} .e-floating-bars__cta-button' => 'flex-direction: {{VALUE}};',
578 ],
579 'condition' => [
580 'cta_icon[value]!' => '',
581 ],
582 ]
583 );
584
585 $this->add_control(
586 'style_cta_icon_spacing',
587 [
588 'label' => esc_html__( 'Icon Spacing', 'elementor' ),
589 'type' => Controls_Manager::SLIDER,
590 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
591 'range' => [
592 'px' => [
593 'max' => 50,
594 ],
595 'em' => [
596 'max' => 5,
597 ],
598 'rem' => [
599 'max' => 5,
600 ],
601 ],
602 'selectors' => [
603 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-icon-gap: {{SIZE}}{{UNIT}};',
604 ],
605 'conditions' => [
606 'relation' => 'and',
607 'terms' => [
608 [
609 'name' => 'cta_icon[value]',
610 'operator' => '!==',
611 'value' => '',
612 ],
613 [
614 'name' => 'cta_icon[value]',
615 'operator' => '!==',
616 'value' => null,
617 ],
618 ],
619 ],
620 ]
621 );
622
623 $this->add_group_control(
624 Group_Control_Typography::get_type(),
625 [
626 'name' => 'style_cta_typography',
627 'selector' => '{{WRAPPER}} .e-floating-bars__cta-button',
628 ]
629 );
630
631 $this->start_controls_tabs(
632 'style_cta_button_tabs'
633 );
634
635 $this->start_controls_tab(
636 'style_cta_button_tabs_normal',
637 [
638 'label' => esc_html__( 'Normal', 'elementor' ),
639 ]
640 );
641
642 $this->add_control(
643 'style_cta_button_text_color',
644 [
645 'label' => esc_html__( 'Text Color', 'elementor' ),
646 'type' => Controls_Manager::COLOR,
647 'selectors' => [
648 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-text-color: {{VALUE}}',
649 ],
650 ]
651 );
652
653 $this->add_control(
654 'style_cta_button_bg_color',
655 [
656 'label' => esc_html__( 'Background Color', 'elementor' ),
657 'type' => Controls_Manager::COLOR,
658 'selectors' => [
659 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-bg-color: {{VALUE}}',
660 ],
661 'condition' => [
662 'style_cta_type' => 'button',
663 ],
664 ]
665 );
666
667 $this->end_controls_tab();
668
669 $this->start_controls_tab(
670 'style_cta_button_tabs_hover',
671 [
672 'label' => esc_html__( 'Hover', 'elementor' ),
673 ]
674 );
675
676 $this->add_control(
677 'style_cta_button_text_color_hover',
678 [
679 'label' => esc_html__( 'Text Color', 'elementor' ),
680 'type' => Controls_Manager::COLOR,
681 'selectors' => [
682 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-text-color-hover: {{VALUE}}',
683 ],
684 ]
685 );
686
687 $this->add_control(
688 'style_cta_button_bg_color_hover',
689 [
690 'label' => esc_html__( 'Background Color', 'elementor' ),
691 'type' => Controls_Manager::COLOR,
692 'selectors' => [
693 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-bg-color-hover: {{VALUE}}',
694 ],
695 'condition' => [
696 'style_cta_type' => 'button',
697 ],
698 ]
699 );
700
701 $this->add_control(
702 'style_cta_button_border_color_hover',
703 [
704 'label' => esc_html__( 'Border Color', 'elementor' ),
705 'type' => Controls_Manager::COLOR,
706 'selectors' => [
707 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-border-color-hover: {{VALUE}}',
708 ],
709 'conditions' => [
710 'relation' => 'and',
711 'terms' => [
712 [
713 'name' => 'style_cta_button_show_border',
714 'operator' => '===',
715 'value' => 'yes',
716 ],
717 [
718 'name' => 'style_cta_type',
719 'operator' => '===',
720 'value' => 'button',
721 ],
722 ],
723 ],
724 ]
725 );
726
727 $this->add_control(
728 'style_cta_button_hover_animation',
729 [
730 'label' => esc_html__( 'Hover Animation', 'elementor' ),
731 'type' => Controls_Manager::HOVER_ANIMATION,
732 'frontend_available' => true,
733 ]
734 );
735
736 $this->end_controls_tab();
737
738 $this->end_controls_tabs();
739
740 $this->add_control(
741 'style_cta_button_show_border',
742 [
743 'label' => esc_html__( 'Border', 'elementor' ),
744 'type' => Controls_Manager::SWITCHER,
745 'label_on' => esc_html__( 'Yes', 'elementor' ),
746 'label_off' => esc_html__( 'No', 'elementor' ),
747 'return_value' => 'yes',
748 'default' => 'yes',
749 'separator' => 'before',
750 'condition' => [
751 'style_cta_type' => 'button',
752 ],
753 ]
754 );
755
756 $this->add_responsive_control(
757 'style_cta_button_border_width',
758 [
759 'label' => esc_html__( 'Border Width', 'elementor' ),
760 'type' => Controls_Manager::SLIDER,
761 'range' => [
762 '%' => [
763 'min' => 10,
764 'max' => 100,
765 ],
766 'px' => [
767 'min' => 0,
768 'max' => 10,
769 ],
770 ],
771 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
772 'selectors' => [
773 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-border-width: {{SIZE}}{{UNIT}}',
774 ],
775 'conditions' => [
776 'relation' => 'and',
777 'terms' => [
778 [
779 'name' => 'style_cta_button_show_border',
780 'operator' => '===',
781 'value' => 'yes',
782 ],
783 [
784 'name' => 'style_cta_type',
785 'operator' => '===',
786 'value' => 'button',
787 ],
788 ],
789 ],
790 ]
791 );
792
793 $this->add_control(
794 'style_cta_button_border_color',
795 [
796 'label' => esc_html__( 'Border Color', 'elementor' ),
797 'type' => Controls_Manager::COLOR,
798 'selectors' => [
799 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-border-color: {{VALUE}}',
800 ],
801 'conditions' => [
802 'relation' => 'and',
803 'terms' => [
804 [
805 'name' => 'style_cta_button_show_border',
806 'operator' => '===',
807 'value' => 'yes',
808 ],
809 [
810 'name' => 'style_cta_type',
811 'operator' => '===',
812 'value' => 'button',
813 ],
814 ],
815 ],
816 ]
817 );
818
819 $this->add_control(
820 'style_cta_button_corners',
821 [
822 'label' => esc_html__( 'Corners', 'elementor' ),
823 'type' => Controls_Manager::SELECT,
824 'default' => 'round',
825 'options' => [
826 'round' => esc_html__( 'Round', 'elementor' ),
827 'rounded' => esc_html__( 'Rounded', 'elementor' ),
828 'sharp' => esc_html__( 'Sharp', 'elementor' ),
829 ],
830 'condition' => [
831 'style_cta_type' => 'button',
832 ],
833 ]
834 );
835
836 $this->add_responsive_control(
837 'style_cta_button_padding',
838 [
839 'label' => esc_html__( 'Padding', 'elementor' ),
840 'type' => Controls_Manager::DIMENSIONS,
841 'size_units' => [ 'px', '%', 'em', 'rem' ],
842 'selectors' => [
843 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-padding-block-end: {{BOTTOM}}{{UNIT}}; --e-floating-bars-cta-button-padding-block-start: {{TOP}}{{UNIT}}; --e-floating-bars-cta-button-padding-inline-end: {{RIGHT}}{{UNIT}}; --e-floating-bars-cta-button-padding-inline-start: {{LEFT}}{{UNIT}};',
844 ],
845 'separator' => 'before',
846 'condition' => [
847 'style_cta_type' => 'button',
848 ],
849 ]
850 );
851
852 $this->add_responsive_control(
853 'style_cta_button_animation',
854 [
855 'label' => esc_html__( 'Entrance Animation', 'elementor' ),
856 'type' => Controls_Manager::ANIMATION,
857 'frontend_available' => true,
858 'separator' => 'before',
859 ]
860 );
861
862 $this->add_control(
863 'style_cta_button_animation_duration',
864 [
865 'label' => esc_html__( 'Animation Duration', 'elementor' ),
866 'type' => Controls_Manager::SELECT,
867 'default' => '1000',
868 'options' => [
869 '2000' => esc_html__( 'Slow', 'elementor' ),
870 '1000' => esc_html__( 'Normal', 'elementor' ),
871 '800' => esc_html__( 'Fast', 'elementor' ),
872 ],
873 'selectors' => [
874 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-animation-duration: {{VALUE}}ms',
875 ],
876 'prefix_class' => 'animated-',
877 'conditions' => [
878 'relation' => 'and',
879 'terms' => [
880 [
881 'name' => 'style_cta_button_animation',
882 'operator' => '!==',
883 'value' => '',
884 ],
885 [
886 'name' => 'style_cta_button_animation',
887 'operator' => '!==',
888 'value' => 'none',
889 ],
890 ],
891 ],
892 ]
893 );
894
895 $this->add_control(
896 'style_cta_button_animation_delay',
897 [
898 'label' => esc_html__( 'Animation Delay', 'elementor' ) . ' (ms)',
899 'type' => Controls_Manager::NUMBER,
900 'min' => 0,
901 'step' => 100,
902 'selectors' => [
903 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-cta-button-animation-delay: {{SIZE}}ms;',
904 ],
905 'render_type' => 'none',
906 'frontend_available' => true,
907 'conditions' => [
908 'relation' => 'and',
909 'terms' => [
910 [
911 'name' => 'style_cta_button_animation',
912 'operator' => '!==',
913 'value' => '',
914 ],
915 [
916 'name' => 'style_cta_button_animation',
917 'operator' => '!==',
918 'value' => 'none',
919 ],
920 ],
921 ],
922 ]
923 );
924
925 $this->end_controls_section();
926 }
927
928 protected function add_floating_bar_background_style_controls(): void {
929 $config = static::get_configuration();
930
931 $this->add_control(
932 'floating_bar_background_heading',
933 [
934 'label' => esc_html__( 'Background', 'elementor' ),
935 'type' => Controls_Manager::HEADING,
936 'separator' => 'before',
937 ]
938 );
939
940 $this->add_group_control(
941 Group_Control_Background::get_type(),
942 [
943 'name' => 'floating_bar_background_type',
944 'types' => [ 'classic', 'gradient' ],
945 'selector' => $config['style']['floating_bar_section']['background_selector'],
946 'fields_options' => [
947 'background' => [
948 'default' => 'classic',
949 ],
950 'position' => [
951 'default' => 'center center',
952 ],
953 'size' => [
954 'default' => 'cover',
955 ],
956 ],
957 ]
958 );
959
960 $this->add_control(
961 'floating_bar_background_overlay_heading',
962 [
963 'label' => esc_html__( 'Background Overlay', 'elementor' ),
964 'type' => Controls_Manager::HEADING,
965 'separator' => 'before',
966 ]
967 );
968
969 $this->add_group_control(
970 Group_Control_Background::get_type(),
971 [
972 'name' => 'floating_bar_background_overlay_type',
973 'types' => [ 'classic', 'gradient' ],
974 'selector' => '{{WRAPPER}} .e-floating-bars__overlay',
975 'fields_options' => [
976 'background' => [
977 'default' => 'classic',
978 ],
979 'position' => [
980 'default' => 'center center',
981 ],
982 'size' => [
983 'default' => 'cover',
984 ],
985 ],
986 ]
987 );
988
989 $this->add_responsive_control(
990 'floating_bar_background_overlay_opacity',
991 [
992 'label' => esc_html__( 'Opacity', 'elementor' ),
993 'type' => Controls_Manager::SLIDER,
994 'range' => [
995 '%' => [
996 'max' => 1,
997 'min' => 0,
998 'step' => 0.01,
999 ],
1000 ],
1001 'default' => [
1002 'unit' => '%',
1003 'size' => 0.5,
1004 ],
1005 'selectors' => [
1006 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-background-overlay-opacity: {{SIZE}};',
1007 ],
1008 ]
1009 );
1010 }
1011
1012 protected function add_floating_bar_close_button_style_controls(): void {
1013 $config = static::get_configuration();
1014
1015 $this->add_control(
1016 'floating_bar_close_button_heading',
1017 [
1018 'label' => esc_html__( 'Close Button', 'elementor' ),
1019 'type' => Controls_Manager::HEADING,
1020 'separator' => 'before',
1021 'condition' => [
1022 'floating_bar_close_switch' => 'yes',
1023 ],
1024 ]
1025 );
1026
1027 if ( $config['style']['floating_bar_section']['has_close_position_control'] ) {
1028 $this->add_responsive_control(
1029 'floating_bar_close_button_position',
1030 [
1031 'label' => esc_html__( 'Horizontal position', 'elementor' ),
1032 'type' => Controls_Manager::CHOOSE,
1033 'options' => [
1034 'start' => [
1035 'title' => esc_html__( 'Left', 'elementor' ),
1036 'icon' => 'eicon-h-align-left',
1037 ],
1038 'end' => [
1039 'title' => esc_html__( 'Right', 'elementor' ),
1040 'icon' => 'eicon-h-align-right',
1041 ],
1042 ],
1043 'default' => 'end',
1044 'toggle' => false,
1045 'selectors' => $config['style']['floating_bar_section']['close_position_selectors'],
1046 'condition' => [
1047 'floating_bar_close_switch' => 'yes',
1048 ],
1049 ]
1050 );
1051 }
1052
1053 $this->add_control(
1054 'floating_bar_close_button_color',
1055 [
1056 'label' => esc_html__( 'Color', 'elementor' ),
1057 'type' => Controls_Manager::COLOR,
1058 'selectors' => [
1059 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-close-button-color: {{VALUE}}',
1060 ],
1061 'condition' => [
1062 'floating_bar_close_switch' => 'yes',
1063 ],
1064 ]
1065 );
1066
1067 $this->add_responsive_control(
1068 'style_floating_bar_close_button_size',
1069 [
1070 'label' => esc_html__( 'Size', 'elementor' ),
1071 'type' => Controls_Manager::SLIDER,
1072 'range' => [
1073 'px' => [
1074 'min' => 0,
1075 'max' => 150,
1076 ],
1077 ],
1078 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
1079 'selectors' => [
1080 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-close-icon-size: {{SIZE}}{{UNIT}}',
1081 ],
1082 'condition' => [
1083 'floating_bar_close_switch' => 'yes',
1084 ],
1085 ]
1086 );
1087
1088 if ( $config['style']['floating_bar_section']['has_close_bg'] ) {
1089 $this->add_control(
1090 'floating_bar_close_bg_color',
1091 [
1092 'label' => esc_html__( 'Background Color', 'elementor' ),
1093 'type' => Controls_Manager::COLOR,
1094 'selectors' => [
1095 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-close-button-bg-color: {{VALUE}}',
1096 ],
1097 'condition' => [
1098 'floating_bar_close_switch' => 'yes',
1099 ],
1100 'separator' => 'after',
1101 ]
1102 );
1103 }
1104 }
1105
1106 protected function add_floating_bar_pause_style_controls(): void {
1107 $config = static::get_configuration();
1108
1109 $this->add_control(
1110 'floating_bar_pause_button_heading',
1111 [
1112 'label' => esc_html__( 'Pause and Play', 'elementor' ),
1113 'type' => Controls_Manager::HEADING,
1114 'condition' => [
1115 'floating_bar_pause_switch' => 'yes',
1116 ],
1117 ]
1118 );
1119
1120 $this->add_control(
1121 'floating_bar_pause_button_color',
1122 [
1123 'label' => esc_html__( 'Icon Color', 'elementor' ),
1124 'type' => Controls_Manager::COLOR,
1125 'selectors' => [
1126 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-pause-play-icon-color: {{VALUE}}',
1127 ],
1128 'condition' => [
1129 'floating_bar_pause_switch' => 'yes',
1130 ],
1131 ]
1132 );
1133
1134 $this->add_control(
1135 'floating_bar_pause_bg_color',
1136 [
1137 'label' => esc_html__( 'Background Color', 'elementor' ),
1138 'type' => Controls_Manager::COLOR,
1139 'selectors' => [
1140 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-pause-play-bg-color: {{VALUE}}',
1141 ],
1142 'condition' => [
1143 'floating_bar_pause_switch' => 'yes',
1144 ],
1145 ]
1146 );
1147 }
1148
1149 protected function add_floating_bar_style_section(): void {
1150 $config = static::get_configuration();
1151
1152 $this->start_controls_section(
1153 'style_floating_bar',
1154 [
1155 'label' => esc_html__( 'Floating Bar', 'elementor' ),
1156 'tab' => Controls_Manager::TAB_STYLE,
1157 ]
1158 );
1159
1160 $this->add_floating_bar_close_button_style_controls();
1161
1162 $this->add_responsive_control(
1163 'style_floating_bar_elements_align',
1164 [
1165 'label' => esc_html__( 'Align Elements', 'elementor' ),
1166 'type' => Controls_Manager::CHOOSE,
1167 'toggle' => false,
1168 'default' => 'center',
1169 'options' => [
1170 'start' => [
1171 'title' => esc_html__( 'Start', 'elementor' ),
1172 'icon' => 'eicon-align-start-h',
1173 ],
1174 'center' => [
1175 'title' => esc_html__( 'Center', 'elementor' ),
1176 'icon' => 'eicon-align-center-h',
1177 ],
1178 'end' => [
1179 'title' => esc_html__( 'End', 'elementor' ),
1180 'icon' => 'eicon-align-end-h',
1181 ],
1182 'space-between' => [
1183 'title' => esc_html__( 'Stretch', 'elementor' ),
1184 'icon' => 'eicon-align-stretch-h',
1185 ],
1186 ],
1187 'selectors' => $config['style']['floating_bar_section']['align_elements_selector'],
1188 'separator' => 'before',
1189 ]
1190 );
1191
1192 $this->add_responsive_control(
1193 'style_floating_bar_elements_spacing',
1194 [
1195 'label' => esc_html__( 'Element spacing', 'elementor' ),
1196 'type' => Controls_Manager::SLIDER,
1197 'range' => [
1198 'px' => [
1199 'min' => 0,
1200 'max' => 50,
1201 ],
1202 ],
1203 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
1204 'selectors' => [
1205 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-elements-gap: {{SIZE}}{{UNIT}}',
1206 ],
1207 'conditions' => [
1208 'relation' => 'and',
1209 'terms' => [
1210 [
1211 'name' => 'style_floating_bar_elements_align',
1212 'operator' => '!==',
1213 'value' => 'stretch',
1214 ],
1215 ],
1216 ],
1217 ]
1218 );
1219
1220 $this->add_responsive_control(
1221 'style_floating_bar_elements_padding',
1222 [
1223 'label' => esc_html__( 'Padding', 'elementor' ),
1224 'type' => Controls_Manager::DIMENSIONS,
1225 'size_units' => [ 'px', '%', 'em', 'rem' ],
1226 'selectors' => [
1227 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-elements-padding-block-end: {{BOTTOM}}{{UNIT}}; --e-floating-bars-elements-padding-block-start: {{TOP}}{{UNIT}}; --e-floating-bars-elements-padding-inline-end: {{RIGHT}}{{UNIT}}; --e-floating-bars-elements-padding-inline-start: {{LEFT}}{{UNIT}};',
1228 ],
1229 ]
1230 );
1231
1232 $this->add_floating_bar_background_style_controls();
1233
1234 $this->end_controls_section();
1235 }
1236
1237 protected function add_headlines_style_section(): void {
1238 $this->start_controls_section(
1239 'style_headlines',
1240 [
1241 'label' => esc_html__( 'Headline', 'elementor' ),
1242 'tab' => Controls_Manager::TAB_STYLE,
1243 ]
1244 );
1245
1246 $this->add_control(
1247 'style_headlines_icon_heading',
1248 [
1249 'label' => esc_html__( 'Icon', 'elementor' ),
1250 'type' => Controls_Manager::HEADING,
1251 ]
1252 );
1253
1254 $this->add_control(
1255 'style_headlines_icon_color',
1256 [
1257 'label' => esc_html__( 'Color', 'elementor' ),
1258 'type' => Controls_Manager::COLOR,
1259 'selectors' => [
1260 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-headline-icon-color: {{VALUE}}',
1261 ],
1262 ]
1263 );
1264
1265 $this->add_responsive_control(
1266 'style_headlines_icon_position',
1267 [
1268 'label' => esc_html__( 'Icon Position', 'elementor' ),
1269 'type' => Controls_Manager::CHOOSE,
1270 'default' => is_rtl() ? 'row-reverse' : 'row',
1271 'toggle' => false,
1272 'options' => [
1273 'row' => [
1274 'title' => esc_html__( 'Start', 'elementor' ),
1275 'icon' => 'eicon-h-align-left',
1276 ],
1277 'row-reverse' => [
1278 'title' => esc_html__( 'End', 'elementor' ),
1279 'icon' => 'eicon-h-align-right',
1280 ],
1281 ],
1282 'selectors_dictionary' => [
1283 'row' => is_rtl() ? 'row-reverse' : 'row',
1284 'row-reverse' => is_rtl() ? 'row' : 'row-reverse',
1285 ],
1286 'selectors' => [
1287 '{{WRAPPER}} .e-floating-bars__headline' => '--e-floating-bars-headline-icon-position: {{VALUE}};',
1288 ],
1289 ]
1290 );
1291
1292 $this->add_responsive_control(
1293 'style_headlines_icon_size',
1294 [
1295 'label' => esc_html__( 'Size', 'elementor' ),
1296 'type' => Controls_Manager::SLIDER,
1297 'range' => [
1298 'px' => [
1299 'min' => 0,
1300 'max' => 150,
1301 ],
1302 ],
1303 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
1304 'selectors' => [
1305 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-headline-icon-size: {{SIZE}}{{UNIT}}',
1306 ],
1307 ]
1308 );
1309
1310 $this->add_responsive_control(
1311 'style_headlines_icon_spacing',
1312 [
1313 'label' => esc_html__( 'Icon Spacing', 'elementor' ),
1314 'type' => Controls_Manager::SLIDER,
1315 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1316 'range' => [
1317 'px' => [
1318 'max' => 50,
1319 ],
1320 'em' => [
1321 'max' => 5,
1322 ],
1323 'rem' => [
1324 'max' => 5,
1325 ],
1326 ],
1327 'selectors' => [
1328 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-headline-icon-gap: {{SIZE}}{{UNIT}}',
1329 ],
1330 ]
1331 );
1332 $this->add_control(
1333 'style_headline_text_heading',
1334 [
1335 'label' => esc_html__( 'Text', 'elementor' ),
1336 'type' => Controls_Manager::HEADING,
1337 'separator' => 'before',
1338 ]
1339 );
1340
1341 $this->add_group_control(
1342 Group_Control_Typography::get_type(),
1343 [
1344 'name' => 'style_headline_text_typography',
1345 'selector' => '{{WRAPPER}} .e-floating-bars__headline-text',
1346 ]
1347 );
1348
1349 $this->start_controls_tabs(
1350 'style_headline_tabs'
1351 );
1352
1353 $this->start_controls_tab(
1354 'style_headline_tabs_normal',
1355 [
1356 'label' => esc_html__( 'Normal', 'elementor' ),
1357 ]
1358 );
1359
1360 $this->add_control(
1361 'style_headline_text_color',
1362 [
1363 'label' => esc_html__( 'Text Color', 'elementor' ),
1364 'type' => Controls_Manager::COLOR,
1365 'selectors' => [
1366 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-headline-text-color: {{VALUE}}',
1367 ],
1368 ]
1369 );
1370
1371 $this->end_controls_tab();
1372
1373 $this->start_controls_tab(
1374 'style_headline_tabs_hover',
1375 [
1376 'label' => esc_html__( 'Hover', 'elementor' ),
1377 ]
1378 );
1379
1380 $this->add_control(
1381 'style_headline_text_color_hover',
1382 [
1383 'label' => esc_html__( 'Text Color', 'elementor' ),
1384 'type' => Controls_Manager::COLOR,
1385 'selectors' => [
1386 '{{WRAPPER}} .e-floating-bars' => '--e-floating-bars-headline-text-color-hover: {{VALUE}}',
1387 ],
1388 ]
1389 );
1390
1391 $this->end_controls_tab();
1392
1393 $this->end_controls_tabs();
1394
1395 $this->end_controls_section();
1396 }
1397
1398 protected function add_advanced_tab(): void {
1399 Controls_Manager::add_tab(
1400 static::TAB_ADVANCED,
1401 esc_html__( 'Advanced', 'elementor' )
1402 );
1403
1404 $this->start_controls_section(
1405 'advanced_layout_section',
1406 [
1407 'label' => esc_html__( 'Layout', 'elementor' ),
1408 'tab' => static::TAB_ADVANCED,
1409 ]
1410 );
1411
1412 $this->add_control(
1413 'advanced_vertical_position',
1414 [
1415 'label' => esc_html__( 'Vertical Position', 'elementor' ),
1416 'type' => Controls_Manager::CHOOSE,
1417 'options' => [
1418 'top' => [
1419 'title' => esc_html__( 'Top', 'elementor' ),
1420 'icon' => 'eicon-v-align-top',
1421 ],
1422 'bottom' => [
1423 'title' => esc_html__( 'Bottom', 'elementor' ),
1424 'icon' => 'eicon-v-align-bottom',
1425 ],
1426 ],
1427 'default' => 'top',
1428 'toggle' => false,
1429 ]
1430 );
1431
1432 $this->add_control(
1433 'advanced_toggle_sticky',
1434 [
1435 'label' => esc_html__( 'Sticky', 'elementor' ),
1436 'type' => Controls_Manager::SWITCHER,
1437 'label_on' => esc_html__( 'Yes', 'elementor' ),
1438 'label_off' => esc_html__( 'No', 'elementor' ),
1439 'return_value' => 'yes',
1440 'default' => 'yes',
1441 ]
1442 );
1443
1444 $this->end_controls_section();
1445
1446 $this->start_controls_section(
1447 'advanced_responsive_section',
1448 [
1449 'label' => esc_html__( 'Responsive', 'elementor' ),
1450 'tab' => static::TAB_ADVANCED,
1451 ]
1452 );
1453
1454 $this->add_control(
1455 'responsive_description',
1456 [
1457 'raw' => __( 'Responsive visibility will take effect only on preview mode or live page, and not while editing in Elementor.', 'elementor' ),
1458 'type' => Controls_Manager::RAW_HTML,
1459 'content_classes' => 'elementor-descriptor',
1460 ]
1461 );
1462
1463 $this->add_hidden_device_controls();
1464
1465 $this->end_controls_section();
1466
1467 $this->start_controls_section(
1468 'advanced_custom_controls_section',
1469 [
1470 'label' => esc_html__( 'CSS', 'elementor' ),
1471 'tab' => static::TAB_ADVANCED,
1472 ]
1473 );
1474
1475 $this->add_control(
1476 'advanced_custom_css_id',
1477 [
1478 'label' => esc_html__( 'CSS ID', 'elementor' ),
1479 'type' => Controls_Manager::TEXT,
1480 'default' => '',
1481 'ai' => [
1482 'active' => false,
1483 ],
1484 'dynamic' => [
1485 'active' => true,
1486 ],
1487 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
1488 'style_transfer' => false,
1489 ]
1490 );
1491
1492 $this->add_control(
1493 'advanced_custom_css_classes',
1494 [
1495 'label' => esc_html__( 'CSS Classes', 'elementor' ),
1496 'type' => Controls_Manager::TEXT,
1497 'default' => '',
1498 'ai' => [
1499 'active' => false,
1500 ],
1501 'dynamic' => [
1502 'active' => true,
1503 ],
1504 'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
1505 ]
1506 );
1507
1508 $this->end_controls_section();
1509
1510 Plugin::$instance->controls_manager->add_custom_css_controls( $this, static::TAB_ADVANCED );
1511
1512 Plugin::$instance->controls_manager->add_custom_attributes_controls( $this, static::TAB_ADVANCED );
1513 }
1514
1515 protected function add_content_tab(): void {
1516 $this->add_announcement_content_section();
1517
1518 $this->add_cta_button_content_section();
1519
1520 $this->add_floating_bar_content_section();
1521 }
1522
1523 protected function add_style_tab(): void {
1524 $this->add_announcement_style_section();
1525
1526 $this->add_cta_button_style_section();
1527
1528 $this->add_floating_bar_style_section();
1529 }
1530
1531 protected function render(): void {
1532 $render_strategy = new Floating_Bars_Core_Render( $this );
1533
1534 $render_strategy->render();
1535 }
1536 }
1537