PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / content / widgets / zig-zag.php

zig-zag.php in Hello Plus 1.2.0, at modules/content/widgets/zig-zag.php

930 lines 22.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\Content\Widgets;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use Elementor\Controls_Manager;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Box_Shadow;
12 use Elementor\Group_Control_Typography;
13 use Elementor\Repeater;
14 use Elementor\Utils;
15 use Elementor\Widget_Base;
16 use Elementor\Core\Kits\Documents\Tabs\{
17 Global_Typography,
18 Global_Colors
19 };
20
21 use HelloPlus\Modules\Content\Classes\{
22 Control_Zig_Zag_Animation,
23 Render\Widget_Zig_Zag_Render
24 };
25 use HelloPlus\Modules\Theme\Module as Theme_Module;
26 use HelloPlus\Classes\Ehp_Button;
27
28 class Zig_Zag extends Widget_Base {
29
30 public function get_name(): string {
31 return 'zigzag';
32 }
33
34 public function get_title(): string {
35 return esc_html__( 'Zigzag', 'hello-plus' );
36 }
37
38 public function get_categories(): array {
39 return [ Theme_Module::HELLOPLUS_EDITOR_CATEGORY_SLUG ];
40 }
41
42 public function get_keywords(): array {
43 return [ 'zigzag', 'content' ];
44 }
45
46 public function get_icon(): string {
47 return 'eicon-ehp-zigzag';
48 }
49
50 public function get_style_depends(): array {
51 return [ 'helloplus-zigzag', 'helloplus-button' ];
52 }
53
54 public function get_script_depends(): array {
55 return [ 'helloplus-zigzag-fe' ];
56 }
57
58 protected function render(): void {
59 $render_strategy = new Widget_Zig_Zag_Render( $this );
60
61 $render_strategy->render();
62 }
63
64 protected function register_controls() {
65 $this->add_content_section();
66 $this->add_style_section();
67 }
68
69 protected function add_content_section() {
70 $this->add_zigzags_content_section();
71 }
72
73 protected function add_style_section() {
74 $this->add_style_layout_section();
75 $this->add_style_image_section();
76 $this->add_style_icon_section();
77 $this->add_style_text_section();
78 $this->add_style_cta_section();
79 $this->add_style_box_section();
80 }
81
82 private function add_zigzags_content_section() {
83 $this->start_controls_section(
84 'zigzags_content_section',
85 [
86 'label' => esc_html__( 'Zigzags', 'hello-plus' ),
87 'tab' => Controls_Manager::TAB_CONTENT,
88 ]
89 );
90
91 $this->add_control(
92 'graphic_element',
93 [
94 'label' => esc_html__( 'Graphic Element', 'hello-plus' ),
95 'type' => Controls_Manager::CHOOSE,
96 'options' => [
97 'image' => [
98 'title' => esc_html__( 'Image', 'hello-plus' ),
99 'icon' => 'eicon-image',
100 ],
101 'icon' => [
102 'title' => esc_html__( 'Icon', 'hello-plus' ),
103 'icon' => 'eicon-star',
104 ],
105 ],
106 'default' => 'image',
107 'toggle' => false,
108 ]
109 );
110
111 $this->add_graphic_element_repeater( 'image' );
112
113 $this->add_graphic_element_repeater( 'icon' );
114
115 $this->add_control(
116 'zigzag_title_tag',
117 [
118 'label' => esc_html__( 'Title HTML Tag', 'hello-plus' ),
119 'type' => Controls_Manager::SELECT,
120 'options' => [
121 'h2' => 'H2',
122 'h3' => 'H3',
123 'h4' => 'H4',
124 'h5' => 'H5',
125 'h6' => 'H6',
126 'div' => 'div',
127 'span' => 'span',
128 'p' => 'p',
129 ],
130 'default' => 'h2',
131 ]
132 );
133
134 $this->end_controls_section();
135 }
136
137 private function add_graphic_element_repeater( $type ) {
138 $repeater = new Repeater();
139
140 if ( 'icon' === $type ) {
141 $repeater->add_control(
142 $type . '_graphic_icon',
143 [
144 'label' => esc_html__( 'Icon', 'hello-plus' ),
145 'type' => Controls_Manager::ICONS,
146 'default' => [
147 'value' => 'fas fa-star',
148 'library' => 'fa-solid',
149 ],
150 ]
151 );
152 }
153
154 if ( 'image' === $type ) {
155 $repeater->add_control(
156 $type . '_graphic_image',
157 [
158 'label' => esc_html__( 'Image', 'hello-plus' ),
159 'type' => Controls_Manager::MEDIA,
160 'default' => [
161 'url' => Utils::get_placeholder_image_src(),
162 ],
163 ]
164 );
165 }
166
167 $repeater->add_control(
168 $type . '_title',
169 [
170 'label' => esc_html__( 'Title', 'hello-plus' ),
171 'type' => Controls_Manager::TEXT,
172 'default' => esc_html__( 'Social media done right', 'hello-plus' ),
173 'label_block' => true,
174 'placeholder' => esc_html__( 'Type your title here', 'hello-plus' ),
175 'dynamic' => [
176 'active' => true,
177 ],
178 ]
179 );
180
181 $repeater->add_control(
182 $type . '_description',
183 [
184 'label' => esc_html__( 'Description', 'hello-plus' ),
185 'type' => Controls_Manager::TEXTAREA,
186 'rows' => 6,
187 'default' => esc_html__( 'Unlock the full potential of social media with our expert strategies and proven techniques. Let us guide you towards success in the online world and make your brand shine on every platform.', 'hello-plus' ),
188 'placeholder' => esc_html__( 'Type your description here', 'hello-plus' ),
189 'dynamic' => [
190 'active' => true,
191 ],
192 ]
193 );
194
195 $repeater->add_control(
196 $type . '_button_label',
197 [
198 'label' => esc_html__( 'CTA Button', 'hello-plus' ),
199 'type' => Controls_Manager::HEADING,
200 ]
201 );
202
203 $repeater->add_control(
204 $type . '_button_text',
205 [
206 'label' => esc_html__( 'Text', 'hello-plus' ),
207 'type' => Controls_Manager::TEXT,
208 'default' => esc_html__( 'Learn More', 'hello-plus' ),
209 'dynamic' => [
210 'active' => true,
211 ],
212 ]
213 );
214
215 $repeater->add_control(
216 $type . '_button_link',
217 [
218 'label' => esc_html__( 'Link', 'hello-plus' ),
219 'type' => Controls_Manager::URL,
220 'dynamic' => [
221 'active' => true,
222 ],
223 'default' => [
224 'url' => '',
225 'is_external' => true,
226 ],
227 ]
228 );
229
230 $repeater->add_control(
231 $type . '_button_icon',
232 [
233 'label' => esc_html__( 'Icon', 'hello-plus' ),
234 'type' => Controls_Manager::ICONS,
235 'label_block' => false,
236 'skin' => 'inline',
237 ]
238 );
239
240 $this->add_control(
241 $type . '_zigzag_items',
242 [
243 'type' => Controls_Manager::REPEATER,
244 'fields' => $repeater->get_controls(),
245 'default' => [
246 [
247 $type . '_title' => esc_html__( 'Social media done right', 'hello-plus' ),
248 $type . '_description' => 'Unlock the full potential of social media with our expert strategies and proven techniques. Let us guide you towards success in the online world and make your brand shine on every platform.',
249 ],
250 [
251 $type . '_title' => esc_html__( 'Award-winning studio', 'hello-plus' ),
252 $type . '_description' => 'Experience the unparalleled creativity and excellence of our award-winning studio. Our team of talented artists and industry professionals are dedicated to delivering innovative and impactful designs.',
253 ],
254 [
255 $type . '_title' => esc_html__( 'Join Our Community', 'hello-plus' ),
256 $type . '_description' => 'Join our vibrant community and connect with like-minded individuals who share your passions and interests. Together, we can inspire, support, and empower each other to reach our goals.',
257 ],
258 [
259 $type . '_title' => esc_html__( 'Your Perfect Match', 'hello-plus' ),
260 $type . '_description' => 'Discover a personalized shopping journey. Our recommendation engine curates items tailored to your tastes. Each suggestion feels hand-picked.',
261 ],
262 ],
263 'title_field' => '{{{ ' . $type . '_title }}}',
264 'condition' => [
265 'graphic_element' => $type,
266 ],
267 ]
268 );
269 }
270
271 private function add_style_layout_section() {
272 $this->start_controls_section(
273 'style_layout_section',
274 [
275 'label' => esc_html__( 'Layout', 'hello-plus' ),
276 'tab' => Controls_Manager::TAB_STYLE,
277 ]
278 );
279
280 $this->add_control(
281 'first_zigzag_direction',
282 [
283 'label' => esc_html__( 'Align First Graphic', 'hello-plus' ),
284 'type' => Controls_Manager::CHOOSE,
285 'options' => [
286 'start' => [
287 'title' => esc_html__( 'Start', 'hello-plus' ),
288 'icon' => 'eicon-order-' . ( is_rtl() ? 'end' : 'start' ),
289 ],
290 'end' => [
291 'title' => esc_html__( 'End', 'hello-plus' ),
292 'icon' => 'eicon-order-' . ( is_rtl() ? 'start' : 'end' ),
293 ],
294 ],
295 'default' => 'start',
296 'description' => esc_html__( 'Zigzag content will be stacked on smaller screens', 'hello-plus' ),
297 ]
298 );
299
300 $this->add_responsive_control(
301 'content_alignment',
302 [
303 'label' => esc_html__( 'Content Position', 'hello-plus' ),
304 'type' => Controls_Manager::CHOOSE,
305 'options' => [
306 'flex-start' => [
307 'title' => esc_html__( 'Start', 'hello-plus' ),
308 'icon' => 'eicon-align-start-v',
309 ],
310 'center' => [
311 'title' => esc_html__( 'Center', 'hello-plus' ),
312 'icon' => 'eicon-align-center-v',
313 ],
314 'flex-end' => [
315 'title' => esc_html__( 'End', 'hello-plus' ),
316 'icon' => 'eicon-align-end-v',
317 ],
318 ],
319 'default' => 'center',
320 'selectors' => [
321 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-content-position: {{VALUE}};',
322 ],
323 ]
324 );
325
326 $this->add_responsive_control(
327 'content_width',
328 [
329 'label' => esc_html__( 'Content Width', 'hello-plus' ),
330 'type' => Controls_Manager::SLIDER,
331 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
332 'range' => [
333 'px' => [
334 'max' => 1600,
335 ],
336 '%' => [
337 'max' => 100,
338 ],
339 ],
340 'selectors' => [
341 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-content-width: {{SIZE}}{{UNIT}};',
342 ],
343 ]
344 );
345
346 $this->end_controls_section();
347 }
348
349 private function add_style_image_section() {
350 $this->start_controls_section(
351 'style_image_section',
352 [
353 'label' => esc_html__( 'Image', 'hello-plus' ),
354 'tab' => Controls_Manager::TAB_STYLE,
355 'condition' => [
356 'graphic_element' => 'image',
357 ],
358 ]
359 );
360
361 $this->add_control(
362 'image_stretch',
363 [
364 'label' => esc_html__( 'Stretch', 'hello-plus' ),
365 'type' => Controls_Manager::SWITCHER,
366 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
367 'label_off' => esc_html__( 'No', 'hello-plus' ),
368 'return_value' => 'yes',
369 'default' => 'no',
370 ]
371 );
372
373 $this->add_responsive_control(
374 'image_height',
375 [
376 'label' => esc_html__( 'Height', 'hello-plus' ),
377 'type' => Controls_Manager::SLIDER,
378 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
379 'range' => [
380 'px' => [
381 'max' => 1500,
382 ],
383 '%' => [
384 'max' => 100,
385 ],
386 ],
387 'default' => [
388 'size' => 440,
389 'unit' => 'px',
390 ],
391 'selectors' => [
392 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-image-height: {{SIZE}}{{UNIT}};',
393 ],
394 ]
395 );
396
397 $this->add_responsive_control(
398 'image_width',
399 [
400 'label' => esc_html__( 'Width', 'hello-plus' ),
401 'type' => Controls_Manager::SELECT,
402 'options' => [
403 '50%' => '50%',
404 '40%' => '40%',
405 '30%' => '30%',
406 ],
407 'default' => '50%',
408 'selectors' => [
409 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-image-width: {{VALUE}};',
410 ],
411 'condition' => [
412 'image_stretch!' => 'yes',
413 ],
414 ]
415 );
416
417 $this->add_responsive_control(
418 'image_position',
419 [
420 'label' => esc_html__( 'Position', 'hello-plus' ),
421 'type' => Controls_Manager::SELECT,
422 'desktop_default' => 'center center',
423 'tablet_default' => 'center center',
424 'mobile_default' => 'center center',
425 'options' => [
426 '' => esc_html__( 'Default', 'hello-plus' ),
427 'center center' => esc_html__( 'Center Center', 'hello-plus' ),
428 'center left' => esc_html__( 'Center Left', 'hello-plus' ),
429 'center right' => esc_html__( 'Center Right', 'hello-plus' ),
430 'top center' => esc_html__( 'Top Center', 'hello-plus' ),
431 'top left' => esc_html__( 'Top Left', 'hello-plus' ),
432 'top right' => esc_html__( 'Top Right', 'hello-plus' ),
433 'bottom center' => esc_html__( 'Bottom Center', 'hello-plus' ),
434 'bottom left' => esc_html__( 'Bottom Left', 'hello-plus' ),
435 'bottom right' => esc_html__( 'Bottom Right', 'hello-plus' ),
436 ],
437 'selectors' => [
438 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-image-position: {{VALUE}}',
439 ],
440 ]
441 );
442
443 $this->end_controls_section();
444 }
445
446 private function add_style_icon_section() {
447 $this->start_controls_section(
448 'icon_style_section',
449 [
450 'label' => esc_html__( 'Icon', 'hello-plus' ),
451 'tab' => Controls_Manager::TAB_STYLE,
452 'condition' => [
453 'graphic_element' => 'icon',
454 ],
455 ]
456 );
457
458 $this->add_responsive_control(
459 'icon_width',
460 [
461 'label' => esc_html__( 'Box Width', 'hello-plus' ),
462 'type' => Controls_Manager::SELECT,
463 'options' => [
464 '50%' => '50%',
465 '30%' => '30%',
466 ],
467 'default' => '50%',
468 'devices' => [ 'desktop', 'tablet', 'mobile' ],
469 'selectors' => [
470 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-icon-width: {{VALUE}};',
471 ],
472 ]
473 );
474
475 $this->add_control(
476 'icon_zigzag_color',
477 [
478 'label' => esc_html__( 'Color', 'hello-plus' ),
479 'type' => Controls_Manager::COLOR,
480 'global' => [
481 'default' => Global_Colors::COLOR_SECONDARY,
482 ],
483 'selectors' => [
484 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-icon-color: {{VALUE}}',
485 ],
486 ]
487 );
488
489 $this->add_control(
490 'has_alternate_icon_color',
491 [
492 'label' => esc_html__( 'Alternate Icon Color', 'hello-plus' ),
493 'type' => Controls_Manager::SWITCHER,
494 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
495 'label_off' => esc_html__( 'No', 'hello-plus' ),
496 'return_value' => 'yes',
497 'default' => 'no',
498 'frontend_available' => true,
499 ]
500 );
501
502 $this->add_control(
503 'icon_alternate_color',
504 [
505 'label' => esc_html__( 'Alternate Color', 'hello-plus' ),
506 'type' => Controls_Manager::COLOR,
507 'global' => [
508 'default' => Global_Colors::COLOR_ACCENT,
509 ],
510 'selectors' => [
511 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-icon-color-alternate: {{VALUE}}',
512 ],
513 'condition' => [
514 'has_alternate_icon_color' => 'yes',
515 ],
516 ]
517 );
518
519 $this->add_responsive_control(
520 'icon_zigzag_size',
521 [
522 'label' => esc_html__( 'Icon Size', 'hello-plus' ),
523 'type' => Controls_Manager::SLIDER,
524 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
525 'range' => [
526 'px' => [
527 'max' => 300,
528 ],
529 '%' => [
530 'max' => 100,
531 ],
532 ],
533 'selectors' => [
534 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-icon-size: {{SIZE}}{{UNIT}};',
535 ],
536 ]
537 );
538
539 $this->end_controls_section();
540 }
541
542 private function add_style_text_section() {
543 $this->start_controls_section(
544 'style_text_section',
545 [
546 'label' => esc_html__( 'Text', 'hello-plus' ),
547 'tab' => Controls_Manager::TAB_STYLE,
548 ]
549 );
550
551 $this->add_control(
552 'style_heading',
553 [
554 'label' => esc_html__( 'Heading', 'hello-plus' ),
555 'type' => Controls_Manager::HEADING,
556 ]
557 );
558
559 $this->add_control(
560 'title_color',
561 [
562 'label' => esc_html__( 'Text Color', 'hello-plus' ),
563 'type' => Controls_Manager::COLOR,
564 'global' => [
565 'default' => Global_Colors::COLOR_SECONDARY,
566 ],
567 'selectors' => [
568 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-title-color: {{VALUE}}',
569 ],
570 ]
571 );
572
573 $this->add_group_control(
574 Group_Control_Typography::get_type(),
575 [
576 'name' => 'title_typography',
577 'selector' => '{{WRAPPER}} .ehp-zigzag__title',
578 'global' => [
579 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
580 ],
581 ]
582 );
583
584 $this->add_control(
585 'style_description',
586 [
587 'label' => esc_html__( 'Description', 'hello-plus' ),
588 'type' => Controls_Manager::HEADING,
589 'separator' => 'before',
590 ]
591 );
592
593 $this->add_control(
594 'description_color',
595 [
596 'label' => esc_html__( 'Text Color', 'hello-plus' ),
597 'type' => Controls_Manager::COLOR,
598 'global' => [
599 'default' => Global_Colors::COLOR_TEXT,
600 ],
601 'selectors' => [
602 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-description-color: {{VALUE}}',
603 ],
604 ]
605 );
606
607 $this->add_group_control(
608 Group_Control_Typography::get_type(),
609 [
610 'name' => 'description_typography',
611 'selector' => '{{WRAPPER}} .ehp-zigzag__description',
612 'global' => [
613 'default' => Global_Typography::TYPOGRAPHY_TEXT,
614 ],
615 ]
616 );
617
618 $this->end_controls_section();
619 }
620
621 private function add_style_cta_section() {
622 $this->start_controls_section(
623 'style_cta_section',
624 [
625 'label' => esc_html__( 'CTA Button', 'hello-plus' ),
626 'tab' => Controls_Manager::TAB_STYLE,
627 ]
628 );
629
630 $defaults = [
631 'has_secondary_cta' => false,
632 'button_default_type' => 'link',
633 ];
634
635 $button = new Ehp_Button( $this, [ 'widget_name' => 'zigzag' ], $defaults );
636 $button->add_button_type_controls(
637 [
638 'type' => 'primary',
639 'ignore_icon_value_condition' => true,
640 ]
641 );
642
643 $this->end_controls_section();
644 }
645
646 private function add_style_box_section() {
647 $this->start_controls_section(
648 'box_style_section',
649 [
650 'label' => esc_html__( 'Box', 'hello-plus' ),
651 'tab' => Controls_Manager::TAB_STYLE,
652 ]
653 );
654
655 $this->add_control(
656 'box_background_label',
657 [
658 'label' => esc_html__( 'Background', 'hello-plus' ),
659 'type' => Controls_Manager::HEADING,
660 ]
661 );
662
663 $this->add_group_control(
664 Group_Control_Background::get_type(),
665 [
666 'name' => 'background',
667 'types' => [ 'classic', 'gradient' ],
668 'exclude' => [ 'image' ],
669 'selector' => '{{WRAPPER}} .ehp-zigzag__item-wrapper',
670
671 ]
672 );
673
674 $this->add_control(
675 'show_alternate_background',
676 [
677 'label' => esc_html__( 'Alternate Background', 'hello-plus' ),
678 'type' => Controls_Manager::SWITCHER,
679 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
680 'label_off' => esc_html__( 'No', 'hello-plus' ),
681 'return_value' => 'yes',
682 'default' => 'no',
683 ]
684 );
685
686 $this->add_group_control(
687 Group_Control_Background::get_type(),
688 [
689 'name' => 'alternate_background',
690 'types' => [ 'classic', 'gradient' ],
691 'exclude' => [ 'image' ],
692 'fields_options' => [
693 'background' => [
694 'default' => 'classic',
695 ],
696 'color' => [
697 'default' => '#F6F7F8',
698 ],
699 ],
700 'condition' => [
701 'show_alternate_background' => 'yes',
702 ],
703 'selector' => '{{WRAPPER}} .ehp-zigzag__item-wrapper:nth-child(even)',
704 ]
705 );
706
707 $this->add_responsive_control(
708 'space_rows',
709 [
710 'label' => esc_html__( 'Column Gap', 'hello-plus' ),
711 'type' => Controls_Manager::SLIDER,
712 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
713 'range' => [
714 'px' => [
715 'min' => 0,
716 'max' => 200,
717 ],
718 '%' => [
719 'min' => 0,
720 'max' => 100,
721 ],
722 ],
723 'selectors' => [
724 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-rows-spacing: {{SIZE}}{{UNIT}};',
725 ],
726 'separator' => 'before',
727 ]
728 );
729
730 $this->add_responsive_control(
731 'elements_gap',
732 [
733 'label' => esc_html__( 'Row Gap', 'hello-plus' ),
734 'type' => Controls_Manager::SLIDER,
735 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
736 'range' => [
737 'px' => [
738 'max' => 200,
739 ],
740 '%' => [
741 'max' => 100,
742 ],
743 ],
744 'selectors' => [
745 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-elements-gap: {{SIZE}}{{UNIT}};',
746 ],
747 ]
748 );
749
750 $this->add_responsive_control(
751 'box_padding',
752 [
753 'label' => esc_html__( 'Padding', 'hello-plus' ),
754 'type' => Controls_Manager::DIMENSIONS,
755 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
756 'selectors' => [
757 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-box-padding-block-end: {{BOTTOM}}{{UNIT}}; --zigzag-box-padding-block-start: {{TOP}}{{UNIT}}; --zigzag-box-padding-inline-end: {{RIGHT}}{{UNIT}}; --zigzag-box-padding-inline-start: {{LEFT}}{{UNIT}};',
758 ],
759 'default' => [
760 'top' => 60,
761 'right' => 0,
762 'bottom' => 60,
763 'left' => 0,
764 'isLinked' => true,
765 ],
766 'separator' => 'before',
767 ]
768 );
769
770 $this->add_control(
771 'animation_label',
772 [
773 'label' => esc_html__( 'Motion Effects', 'hello-plus' ),
774 'type' => Controls_Manager::HEADING,
775 'separator' => 'before',
776 ]
777 );
778
779 $this->add_responsive_control(
780 'zigzag_animation',
781 [
782 'label' => esc_html__( 'Sequenced Entrance Animation', 'hello-plus' ),
783 'type' => Control_Zig_Zag_Animation::CONTROL_TYPE,
784 'frontend_available' => true,
785 ]
786 );
787
788 $this->add_control(
789 'zigzag_animation_duration',
790 [
791 'label' => esc_html__( 'Animation Duration', 'hello-plus' ),
792 'type' => Controls_Manager::SELECT,
793 'options' => [
794 'slow' => esc_html__( 'Slow', 'hello-plus' ),
795 'normal' => esc_html__( 'Normal', 'hello-plus' ),
796 'fast' => esc_html__( 'Fast', 'hello-plus' ),
797 ],
798 'default' => 'normal',
799 'selectors' => [
800 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-animation-duration: var(--zigzag-animation-duration-{{VALUE}});',
801 ],
802 'condition' => [
803 'zigzag_animation!' => '',
804 ],
805 ]
806 );
807 $this->add_control(
808 'animation_delay',
809 [
810 'label' => esc_html__( 'Animation Delay', 'hello-plus' ) . ' (ms)',
811 'type' => Controls_Manager::NUMBER,
812 'default' => '',
813 'min' => 0,
814 'step' => 100,
815 'selectors' => [
816 '{{WRAPPER}} .ehp-zigzag' => '--zigzag-animation-delay: {{VALUE}}ms;',
817 ],
818 'condition' => [
819 'zigzag_animation!' => '',
820 ],
821 'render_type' => 'none',
822 'frontend_available' => true,
823 ]
824 );
825
826 $this->add_control(
827 'animation_alternate',
828 [
829 'label' => esc_html__( 'Alternate Entrance Animation', 'hello-plus' ),
830 'type' => Controls_Manager::SWITCHER,
831 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
832 'label_off' => esc_html__( 'No', 'hello-plus' ),
833 'return_value' => 'yes',
834 'default' => 'no',
835 'conditions' => [
836 'relation' => 'or',
837 'terms' => [
838 [
839 'name' => 'zigzag_animation',
840 'operator' => '===',
841 'value' => 'fadeInLeft',
842 ],
843 [
844 'name' => 'zigzag_animation',
845 'operator' => '===',
846 'value' => 'fadeInRight',
847 ],
848 [
849 'name' => 'zigzag_animation',
850 'operator' => '===',
851 'value' => 'bounceInLeft',
852 ],
853 [
854 'name' => 'zigzag_animation',
855 'operator' => '===',
856 'value' => 'bounceInRight',
857 ],
858 [
859 'name' => 'zigzag_animation',
860 'operator' => '===',
861 'value' => 'slideInLeft',
862 ],
863 [
864 'name' => 'zigzag_animation',
865 'operator' => '===',
866 'value' => 'slideInRight',
867 ],
868 ],
869 ],
870 ]
871 );
872
873 $this->add_responsive_control(
874 'zigzag_animation_alternate',
875 [
876 'label' => esc_html__( 'Alternate Entrance Animation', 'hello-plus' ),
877 'type' => Control_Zig_Zag_Animation::CONTROL_TYPE,
878 'frontend_available' => true,
879 'conditions' => [
880 'relation' => 'and',
881 'terms' => [
882 [
883 'name' => 'animation_alternate',
884 'operator' => '===',
885 'value' => 'yes',
886 ],
887 [
888 'relation' => 'or',
889 'terms' => [
890 [
891 'name' => 'zigzag_animation',
892 'operator' => '===',
893 'value' => 'fadeInLeft',
894 ],
895 [
896 'name' => 'zigzag_animation',
897 'operator' => '===',
898 'value' => 'fadeInRight',
899 ],
900 [
901 'name' => 'zigzag_animation',
902 'operator' => '===',
903 'value' => 'bounceInLeft',
904 ],
905 [
906 'name' => 'zigzag_animation',
907 'operator' => '===',
908 'value' => 'bounceInRight',
909 ],
910 [
911 'name' => 'zigzag_animation',
912 'operator' => '===',
913 'value' => 'slideInLeft',
914 ],
915 [
916 'name' => 'zigzag_animation',
917 'operator' => '===',
918 'value' => 'slideInRight',
919 ],
920 ],
921 ],
922 ],
923 ],
924 ]
925 );
926
927 $this->end_controls_section();
928 }
929 }
930