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 / flex-hero.php

flex-hero.php in Hello Plus 1.2.0, at modules/content/widgets/flex-hero.php

1,095 lines 26.3 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\Group_Control_Css_Filter;
14 use Elementor\Widget_Base;
15 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
16 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
17
18 use Elementor\Utils as Elementor_Utils;
19
20 use HelloPlus\Modules\Content\Base\Traits\Shared_Content_Traits;
21 use HelloPlus\Modules\Content\Classes\Choose_Img_Control;
22 use HelloPlus\Modules\Content\Classes\Render\Widget_Flex_Hero_Render;
23 use HelloPlus\Modules\Theme\Module as Theme_Module;
24 use HelloPlus\Classes\Ehp_Button;
25
26 class Flex_Hero extends Widget_Base {
27
28 use Shared_Content_Traits;
29
30 public function get_name(): string {
31 return 'flex-hero';
32 }
33
34 public function get_title(): string {
35 return esc_html__( 'Flex Hero', '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 [ 'flex-hero' ];
44 }
45
46 public function get_icon(): string {
47 return 'eicon-ehp-hero';
48 }
49
50 public function get_style_depends(): array {
51 return [ 'helloplus-flex-hero', 'helloplus-button' ];
52 }
53
54 protected function render(): void {
55 $render_strategy = new Widget_Flex_Hero_Render( $this );
56
57 $this->add_inline_editing_attributes( 'intro_text', 'basic' );
58 $this->add_inline_editing_attributes( 'heading_text', 'basic' );
59 $this->add_inline_editing_attributes( 'subheading_text', 'basic' );
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_content_layout_section();
71 $this->add_content_text_section();
72 $this->add_content_cta_section();
73 $this->add_content_image_section();
74 }
75
76 protected function add_style_section() {
77 $this->add_style_layout_section();
78 $this->add_style_content_section();
79 $this->add_style_cta_section();
80 $this->add_style_image_section();
81 $this->add_style_box_section();
82 }
83
84 protected function add_content_layout_section() {
85 $this->start_controls_section(
86 'content_layout',
87 [
88 'label' => esc_html__( 'Layout', 'hello-plus' ),
89 'tab' => Controls_Manager::TAB_CONTENT,
90 ]
91 );
92
93 $this->add_control(
94 'layout_preset',
95 [
96 'label' => esc_html__( 'Preset', 'hello-plus' ),
97 'type' => Choose_Img_Control::CONTROL_NAME,
98 'default' => 'showcase',
99 'label_block' => true,
100 'columns' => 2,
101 'options' => [
102 'showcase' => [
103 'title' => wp_kses_post( "Showcase:\nHighlight key concepts\nwith a balanced layout." ),
104 'image' => HELLOPLUS_IMAGES_URL . 'showcase.svg',
105 'hover_image' => true,
106 ],
107 'storytelling' => [
108 'title' => wp_kses_post( "Storytelling:\nFocus on a narrative\nwith supporting visuals." ),
109 'image' => HELLOPLUS_IMAGES_URL . 'storytelling.svg',
110 'hover_image' => true,
111 ],
112 ],
113 'frontend_available' => true,
114 ]
115 );
116
117 $this->end_controls_section();
118 }
119
120 protected function add_content_text_section() {
121 $this->start_controls_section(
122 'content_text',
123 [
124 'label' => esc_html__( 'Text', 'hello-plus' ),
125 'tab' => Controls_Manager::TAB_CONTENT,
126 ]
127 );
128
129 $this->add_control(
130 'intro_text',
131 [
132 'label' => esc_html__( 'Intro', 'hello-plus' ),
133 'type' => Controls_Manager::TEXTAREA,
134 'rows' => 6,
135 'default' => esc_html__( 'Start your journey', 'hello-plus' ),
136 'placeholder' => esc_html__( 'Type your description here', 'hello-plus' ),
137 'dynamic' => [
138 'active' => true,
139 ],
140 ]
141 );
142
143 $this->add_control(
144 'intro_tag',
145 [
146 'label' => esc_html__( 'HTML Tag', 'hello-plus' ),
147 'type' => Controls_Manager::SELECT,
148 'options' => [
149 'h1' => 'H1',
150 'h2' => 'H2',
151 'h3' => 'H3',
152 'h4' => 'H4',
153 'h5' => 'H5',
154 'h6' => 'H6',
155 'div' => 'div',
156 'span' => 'span',
157 'p' => 'p',
158 ],
159 'default' => 'p',
160 ]
161 );
162
163 $this->add_control(
164 'heading_text',
165 [
166 'label' => esc_html__( 'Heading', 'hello-plus' ),
167 'type' => Controls_Manager::TEXTAREA,
168 'rows' => 6,
169 'default' => esc_html__( 'Achieve your goals with a personal trainer who cares', 'hello-plus' ),
170 'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ),
171 'dynamic' => [
172 'active' => true,
173 ],
174 ]
175 );
176
177 $this->add_control(
178 'heading_tag',
179 [
180 'label' => esc_html__( 'HTML Tag', 'hello-plus' ),
181 'type' => Controls_Manager::SELECT,
182 'options' => [
183 'h1' => 'H1',
184 'h2' => 'H2',
185 'h3' => 'H3',
186 'h4' => 'H4',
187 'h5' => 'H5',
188 'h6' => 'H6',
189 'div' => 'div',
190 'span' => 'span',
191 'p' => 'p',
192 ],
193 'default' => 'h2',
194 ]
195 );
196
197 $this->add_control(
198 'subheading_text',
199 [
200 'label' => esc_html__( 'Subheading', 'hello-plus' ),
201 'type' => Controls_Manager::TEXTAREA,
202 'rows' => 6,
203 'default' => esc_html__( 'Get customized workouts, expert guidance, and the motivation you need to feel your best.', 'hello-plus' ),
204 'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ),
205 'dynamic' => [
206 'active' => true,
207 ],
208 ]
209 );
210
211 $this->add_control(
212 'subheading_tag',
213 [
214 'label' => esc_html__( 'HTML Tag', 'hello-plus' ),
215 'type' => Controls_Manager::SELECT,
216 'options' => [
217 'h2' => 'H2',
218 'h3' => 'H3',
219 'h4' => 'H4',
220 'h5' => 'H5',
221 'h6' => 'H6',
222 'div' => 'div',
223 'span' => 'span',
224 'p' => 'p',
225 ],
226 'default' => 'h3',
227 ]
228 );
229
230 $this->end_controls_section();
231 }
232
233 protected function add_content_cta_section() {
234 $defaults = [
235 'secondary_cta_show' => 'no',
236 ];
237 $button = new Ehp_Button( $this, [ 'widget_name' => 'flex-hero' ], $defaults );
238 $button->add_content_section();
239 }
240
241 protected function add_content_image_section() {
242 $this->start_controls_section(
243 'content_image',
244 [
245 'label' => esc_html__( 'Image', 'hello-plus' ),
246 'tab' => Controls_Manager::TAB_CONTENT,
247 ]
248 );
249
250 $this->add_control(
251 'image',
252 [
253 'label' => esc_html__( 'Choose Image', 'hello-plus' ),
254 'type' => Controls_Manager::MEDIA,
255 'default' => [
256 'url' => Elementor_Utils::get_placeholder_image_src(),
257 ],
258 ]
259 );
260
261 $this->end_controls_section();
262 }
263
264 protected function add_style_layout_section() {
265 $this->start_controls_section(
266 'style_layout',
267 [
268 'label' => esc_html__( 'Layout', 'hello-plus' ),
269 'tab' => Controls_Manager::TAB_STYLE,
270 ]
271 );
272
273 $this->add_responsive_control(
274 'layout_image_position',
275 [
276 'label' => esc_html__( 'Image Position', 'hello-plus' ),
277 'type' => Controls_Manager::CHOOSE,
278 'default' => is_rtl() ? 'start' : 'end',
279 'options' => [
280 'start' => [
281 'title' => esc_html__( 'Start', 'hello-plus' ),
282 'icon' => 'eicon-h-align-' . ( is_rtl() ? 'right' : 'left' ),
283 ],
284 'end' => [
285 'title' => esc_html__( 'End', 'hello-plus' ),
286 'icon' => 'eicon-h-align-' . ( is_rtl() ? 'left' : 'right' ),
287 ],
288 ],
289 'condition' => [
290 'layout_preset' => 'showcase',
291 ],
292 'frontend_available' => true,
293 ]
294 );
295
296 $this->add_responsive_control(
297 'layout_content_position',
298 [
299 'label' => esc_html__( 'Content Position', 'hello-plus' ),
300 'type' => Controls_Manager::CHOOSE,
301 'options' => [
302 'flex-start' => [
303 'title' => esc_html__( 'Start', 'hello-plus' ),
304 'icon' => 'eicon-h-align-' . ( is_rtl() ? 'right' : 'left' ),
305 ],
306 'center' => [
307 'title' => esc_html__( 'Center', 'hello-plus' ),
308 'icon' => 'eicon-h-align-center',
309 ],
310 ],
311 'default' => 'center',
312 'tablet_default' => 'center',
313 'mobile_default' => 'center',
314 'selectors' => [
315 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-content-position: {{VALUE}};',
316 ],
317 'condition' => [
318 'layout_preset' => 'storytelling',
319 ],
320 ]
321 );
322
323 $this->add_control(
324 'layout_content_alignment',
325 [
326 'label' => esc_html__( 'Content Alignment', 'hello-plus' ),
327 'type' => Controls_Manager::CHOOSE,
328 'options' => [
329 'start' => [
330 'title' => esc_html__( 'Start', 'hello-plus' ),
331 'icon' => 'eicon-align-start-v',
332 ],
333 'center' => [
334 'title' => esc_html__( 'Center', 'hello-plus' ),
335 'icon' => 'eicon-align-center-v',
336 ],
337 'end' => [
338 'title' => esc_html__( 'End', 'hello-plus' ),
339 'icon' => 'eicon-align-end-v',
340 ],
341 ],
342 'default' => 'center',
343 'tablet_default' => 'center',
344 'mobile_default' => 'center',
345 'selectors' => [
346 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-content-alignment-showcase: {{VALUE}};',
347 ],
348 'condition' => [
349 'layout_preset' => 'showcase',
350 ],
351 ]
352 );
353
354 $this->add_responsive_control(
355 'layout_text_alignment',
356 [
357 'label' => esc_html__( 'Content Alignment', 'hello-plus' ),
358 'type' => Controls_Manager::CHOOSE,
359 'options' => [
360 'start' => [
361 'title' => esc_html__( 'Start', 'hello-plus' ),
362 'icon' => 'eicon-align-start-h',
363 ],
364 'center' => [
365 'title' => esc_html__( 'Center', 'hello-plus' ),
366 'icon' => 'eicon-align-center-h',
367 ],
368 ],
369 'default' => 'center',
370 'tablet_default' => 'center',
371 'mobile_default' => 'center',
372 'selectors' => [
373 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-content-alignment-storytelling: {{VALUE}};',
374 ],
375 'conditions' => [
376 'relation' => 'and',
377 'terms' => [
378 [
379 'name' => 'layout_preset',
380 'operator' => '==',
381 'value' => 'storytelling',
382 ],
383 [
384 'name' => 'layout_content_position',
385 'operator' => '==',
386 'value' => 'center',
387 ],
388 ],
389 ],
390 ]
391 );
392
393 $this->add_responsive_control(
394 'layout_content_width',
395 [
396 'label' => esc_html__( 'Content Width', 'hello-plus' ),
397 'type' => Controls_Manager::SLIDER,
398 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
399 'range' => [
400 'px' => [
401 'max' => 1200,
402 ],
403 '%' => [
404 'max' => 100,
405 ],
406 ],
407 'default' => [
408 'size' => 648,
409 'unit' => 'px',
410 ],
411 'tablet_default' => [
412 'size' => 648,
413 'unit' => 'px',
414 ],
415 'mobile_default' => [
416 'size' => 648,
417 'unit' => 'px',
418 ],
419 'selectors' => [
420 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-content-width: {{SIZE}}{{UNIT}};',
421 ],
422 'condition' => [
423 'layout_preset' => 'storytelling',
424 ],
425 ]
426 );
427
428 $this->end_controls_section();
429 }
430
431 protected function add_style_content_section() {
432 $this->start_controls_section(
433 'style_content',
434 [
435 'label' => esc_html__( 'Content', 'hello-plus' ),
436 'tab' => Controls_Manager::TAB_STYLE,
437 ]
438 );
439
440 $this->add_control(
441 'intro_label',
442 [
443 'label' => esc_html__( 'Intro', 'hello-plus' ),
444 'type' => Controls_Manager::HEADING,
445 ]
446 );
447
448 $this->add_control(
449 'intro_color',
450 [
451 'label' => esc_html__( 'Text Color', 'hello-plus' ),
452 'type' => Controls_Manager::COLOR,
453 'global' => [
454 'default' => Global_Colors::COLOR_TEXT,
455 ],
456 'selectors' => [
457 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-intro-color: {{VALUE}}',
458 ],
459 ]
460 );
461
462 $this->add_group_control(
463 Group_Control_Typography::get_type(),
464 [
465 'name' => 'intro_typography',
466 'selector' => '{{WRAPPER}} .ehp-flex-hero__intro',
467 'global' => [
468 'default' => Global_Typography::TYPOGRAPHY_TEXT,
469 ],
470 ]
471 );
472
473 $this->add_control(
474 'heading_label',
475 [
476 'label' => esc_html__( 'Heading', 'hello-plus' ),
477 'type' => Controls_Manager::HEADING,
478 'separator' => 'before',
479 ]
480 );
481
482 $this->add_control(
483 'heading_color',
484 [
485 'label' => esc_html__( 'Text Color', 'hello-plus' ),
486 'type' => Controls_Manager::COLOR,
487 'global' => [
488 'default' => Global_Colors::COLOR_PRIMARY,
489 ],
490 'selectors' => [
491 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-heading-color: {{VALUE}}',
492 ],
493 ]
494 );
495
496 $this->add_group_control(
497 Group_Control_Typography::get_type(),
498 [
499 'name' => 'heading_typography',
500 'selector' => '{{WRAPPER}} .ehp-flex-hero__heading',
501 'global' => [
502 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
503 ],
504 ]
505 );
506
507 $this->add_control(
508 'subheading_label',
509 [
510 'label' => esc_html__( 'Subheading', 'hello-plus' ),
511 'type' => Controls_Manager::HEADING,
512 'separator' => 'before',
513 ]
514 );
515
516 $this->add_control(
517 'subheading_color',
518 [
519 'label' => esc_html__( 'Text Color', 'hello-plus' ),
520 'type' => Controls_Manager::COLOR,
521 'global' => [
522 'default' => Global_Colors::COLOR_SECONDARY,
523 ],
524 'selectors' => [
525 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-subheading-color: {{VALUE}}',
526 ],
527 ]
528 );
529
530 $this->add_group_control(
531 Group_Control_Typography::get_type(),
532 [
533 'name' => 'subheading_typography',
534 'selector' => '{{WRAPPER}} .ehp-flex-hero__subheading',
535 'global' => [
536 'default' => Global_Typography::TYPOGRAPHY_SECONDARY,
537 ],
538 ]
539 );
540
541 $this->end_controls_section();
542 }
543
544 protected function add_style_cta_section() {
545 $this->start_controls_section(
546 'style_cta',
547 [
548 'label' => esc_html__( 'CTA Button', 'hello-plus' ),
549 'tab' => Controls_Manager::TAB_STYLE,
550 ]
551 );
552
553 $button = new Ehp_Button( $this, [ 'widget_name' => 'flex-hero' ] );
554 $button->add_style_controls();
555
556 $this->end_controls_section();
557 }
558
559 protected function add_style_image_section() {
560 $this->start_controls_section(
561 'style_image_section',
562 [
563 'label' => esc_html__( 'Image', 'hello-plus' ),
564 'tab' => Controls_Manager::TAB_STYLE,
565 ]
566 );
567
568 $this->add_control(
569 'image_stretch',
570 [
571 'label' => esc_html__( 'Stretch', 'hello-plus' ),
572 'type' => Controls_Manager::SWITCHER,
573 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
574 'label_off' => esc_html__( 'No', 'hello-plus' ),
575 'return_value' => 'yes',
576 'default' => 'no',
577 ]
578 );
579
580 $this->add_responsive_control(
581 'image_height',
582 [
583 'label' => esc_html__( 'Height', 'hello-plus' ),
584 'type' => Controls_Manager::SLIDER,
585 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
586 'range' => [
587 'px' => [
588 'max' => 1500,
589 ],
590 '%' => [
591 'max' => 100,
592 ],
593 ],
594 'default' => [
595 'size' => 380,
596 'unit' => 'px',
597 ],
598 'selectors' => [
599 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-height: {{SIZE}}{{UNIT}};',
600 ],
601 'condition' => [
602 'image_stretch!' => 'yes',
603 ],
604 ]
605 );
606
607 $this->add_responsive_control(
608 'image_width',
609 [
610 'label' => esc_html__( 'Width', 'hello-plus' ),
611 'type' => Controls_Manager::SLIDER,
612 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
613 'range' => [
614 'px' => [
615 'max' => 1500,
616 ],
617 '%' => [
618 'max' => 100,
619 ],
620 ],
621 'default' => [
622 'size' => 100,
623 'unit' => '%',
624 ],
625 'selectors' => [
626 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-width: {{SIZE}}{{UNIT}};',
627 ],
628 'condition' => [
629 'image_stretch!' => 'yes',
630 ],
631 ]
632 );
633
634 $this->add_responsive_control(
635 'image_min_height',
636 [
637 'label' => esc_html__( 'Min Height', 'hello-plus' ),
638 'type' => Controls_Manager::SLIDER,
639 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
640 'range' => [
641 'px' => [
642 'max' => 1500,
643 ],
644 '%' => [
645 'max' => 100,
646 ],
647 ],
648 'selectors' => [
649 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-min-height: {{SIZE}}{{UNIT}};',
650 ],
651 'condition' => [
652 'image_stretch' => 'yes',
653 ],
654 ]
655 );
656
657 $this->add_responsive_control(
658 'image_position',
659 [
660 'label' => esc_html__( 'Position', 'hello-plus' ),
661 'type' => Controls_Manager::SELECT,
662 'desktop_default' => 'center center',
663 'tablet_default' => 'center center',
664 'mobile_default' => 'center center',
665 'options' => [
666 '' => esc_html__( 'Default', 'hello-plus' ),
667 'center center' => esc_html__( 'Center Center', 'hello-plus' ),
668 'center left' => esc_html__( 'Center Left', 'hello-plus' ),
669 'center right' => esc_html__( 'Center Right', 'hello-plus' ),
670 'top center' => esc_html__( 'Top Center', 'hello-plus' ),
671 'top left' => esc_html__( 'Top Left', 'hello-plus' ),
672 'top right' => esc_html__( 'Top Right', 'hello-plus' ),
673 'bottom center' => esc_html__( 'Bottom Center', 'hello-plus' ),
674 'bottom left' => esc_html__( 'Bottom Left', 'hello-plus' ),
675 'bottom right' => esc_html__( 'Bottom Right', 'hello-plus' ),
676 ],
677 'selectors' => [
678 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-position: {{VALUE}}',
679 ],
680 ]
681 );
682
683 $this->add_group_control(
684 Group_Control_Css_Filter::get_type(),
685 [
686 'name' => 'image_css_filters',
687 'selector' => '{{WRAPPER}} .ehp-flex-hero__image img',
688 ]
689 );
690
691 $this->add_control(
692 'show_image_border',
693 [
694 'label' => esc_html__( 'Border', 'hello-plus' ),
695 'type' => Controls_Manager::SWITCHER,
696 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
697 'label_off' => esc_html__( 'No', 'hello-plus' ),
698 'return_value' => 'yes',
699 'default' => 'no',
700 'separator' => 'before',
701 ]
702 );
703
704 $this->add_control(
705 'image_border_width',
706 [
707 'label' => __( 'Border Width', 'hello-plus' ),
708 'type' => Controls_Manager::SLIDER,
709 'size_units' => [ 'px' ],
710 'range' => [
711 'px' => [
712 'min' => 0,
713 'max' => 10,
714 'step' => 1,
715 ],
716 ],
717 'default' => [
718 'size' => 1,
719 'unit' => 'px',
720 ],
721 'selectors' => [
722 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-border-width: {{SIZE}}{{UNIT}};',
723 ],
724 'condition' => [
725 'show_image_border' => 'yes',
726 ],
727 ]
728 );
729
730 $this->add_control(
731 'image_border_color',
732 [
733 'label' => esc_html__( 'Color', 'hello-plus' ),
734 'type' => Controls_Manager::COLOR,
735 'global' => [
736 'default' => Global_Colors::COLOR_TEXT,
737 ],
738 'selectors' => [
739 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-border-color: {{VALUE}}',
740 ],
741 'condition' => [
742 'show_image_border' => 'yes',
743 ],
744 ]
745 );
746
747 $this->add_responsive_control(
748 'image_shape',
749 [
750 'label' => esc_html__( 'Shape', 'hello-plus' ),
751 'type' => Controls_Manager::SELECT,
752 'default' => 'sharp',
753 'options' => [
754 'sharp' => esc_html__( 'Sharp', 'hello-plus' ),
755 'rounded' => esc_html__( 'Rounded', 'hello-plus' ),
756 'round' => esc_html__( 'Round', 'hello-plus' ),
757 'oval' => esc_html__( 'Oval', 'hello-plus' ),
758 'custom' => esc_html__( 'Custom', 'hello-plus' ),
759 ],
760 'frontend_available' => true,
761 ]
762 );
763
764 $this->add_responsive_control(
765 'image_shape_custom',
766 [
767 'label' => esc_html__( 'Border Radius', 'hello-plus' ),
768 'type' => Controls_Manager::DIMENSIONS,
769 'size_units' => [ 'px', '%', 'em', 'rem' ],
770 'selectors' => [
771 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-image-border-radius-custom-block-end: {{BOTTOM}}{{UNIT}}; --flex-hero-image-border-radius-custom-block-start: {{TOP}}{{UNIT}}; --flex-hero-image-border-radius-custom-inline-end: {{RIGHT}}{{UNIT}}; --flex-hero-image-border-radius-custom-inline-start: {{LEFT}}{{UNIT}};',
772 ],
773 'separator' => 'before',
774 'condition' => [
775 'image_shape' => 'custom',
776 ],
777 ]
778 );
779
780 $this->add_group_control(
781 Group_Control_Box_Shadow::get_type(),
782 [
783 'name' => 'image_box_shadow',
784 'selector' => '{{WRAPPER}} .ehp-flex-hero__image img',
785 ]
786 );
787
788 $this->end_controls_section();
789 }
790
791 protected function add_style_box_section() {
792 $this->start_controls_section(
793 'style_box_section',
794 [
795 'label' => esc_html__( 'Box', 'hello-plus' ),
796 'tab' => Controls_Manager::TAB_STYLE,
797 ]
798 );
799
800 $this->add_control(
801 'box_background_label',
802 [
803 'label' => esc_html__( 'Background', 'hello-plus' ),
804 'type' => Controls_Manager::HEADING,
805 ]
806 );
807
808 $this->add_group_control(
809 Group_Control_Background::get_type(),
810 [
811 'name' => 'background',
812 'types' => [ 'classic', 'gradient' ],
813 'selector' => '{{WRAPPER}} .ehp-flex-hero',
814 'fields_options' => [
815 'background' => [
816 'default' => 'classic',
817 ],
818 ],
819 ]
820 );
821
822 $this->add_control(
823 'box_background_overlay_label',
824 [
825 'label' => esc_html__( 'Background Overlay', 'hello-plus' ),
826 'type' => Controls_Manager::HEADING,
827 'separator' => 'before',
828 ]
829 );
830
831 $this->add_group_control(
832 Group_Control_Background::get_type(),
833 [
834 'name' => 'background_overlay',
835 'types' => [ 'classic', 'gradient' ],
836 'selector' => '{{WRAPPER}} .ehp-flex-hero__overlay',
837 'fields_options' => [
838 'background' => [
839 'default' => 'classic',
840 ],
841 ],
842 'frontend_available' => true,
843 ]
844 );
845
846 $this->add_responsive_control(
847 'background_overlay_opacity',
848 [
849 'label' => esc_html__( 'Opacity', 'hello-plus' ),
850 'type' => Controls_Manager::SLIDER,
851 'range' => [
852 '%' => [
853 'max' => 1,
854 'min' => 0.10,
855 'step' => 0.01,
856 ],
857 ],
858 'default' => [
859 'unit' => '%',
860 'size' => 0.5,
861 ],
862 'selectors' => [
863 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-overlay-opacity: {{SIZE}};',
864 ],
865 ]
866 );
867
868 $this->add_responsive_control(
869 'box_element_spacing',
870 [
871 'label' => esc_html__( 'Element Spacing', 'hello-plus' ),
872 'type' => Controls_Manager::SLIDER,
873 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
874 'range' => [
875 'px' => [
876 'max' => 100,
877 ],
878 'em' => [
879 'max' => 5,
880 ],
881 'rem' => [
882 'max' => 5,
883 ],
884 '%' => [
885 'max' => 100,
886 ],
887 ],
888 'default' => [
889 'size' => 40,
890 'unit' => 'px',
891 ],
892 'tablet_default' => [
893 'size' => 28,
894 'unit' => 'px',
895 ],
896 'mobile_default' => [
897 'size' => 20,
898 'unit' => 'px',
899 ],
900 'selectors' => [
901 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-element-spacing: {{SIZE}}{{UNIT}};',
902 ],
903 'separator' => 'before',
904 ]
905 );
906
907 $this->add_responsive_control(
908 'box_gap',
909 [
910 'label' => esc_html__( 'Gap', 'hello-plus' ),
911 'type' => Controls_Manager::SLIDER,
912 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
913 'range' => [
914 'px' => [
915 'max' => 100,
916 ],
917 'em' => [
918 'max' => 5,
919 ],
920 'rem' => [
921 'max' => 5,
922 ],
923 '%' => [
924 'max' => 100,
925 ],
926 ],
927 'default' => [
928 'size' => 60,
929 'unit' => 'px',
930 ],
931 'tablet_default' => [
932 'size' => 60,
933 'unit' => 'px',
934 ],
935 'mobile_default' => [
936 'size' => 60,
937 'unit' => 'px',
938 ],
939 'selectors' => [
940 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-gap: {{SIZE}}{{UNIT}};',
941 ],
942 'separator' => 'before',
943 ]
944 );
945
946 $this->add_control(
947 'show_box_border',
948 [
949 'label' => esc_html__( 'Border', 'hello-plus' ),
950 'type' => Controls_Manager::SWITCHER,
951 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
952 'label_off' => esc_html__( 'No', 'hello-plus' ),
953 'return_value' => 'yes',
954 'default' => 'no',
955 'separator' => 'before',
956 ]
957 );
958
959 $this->add_control(
960 'box_border_width',
961 [
962 'label' => __( 'Border Width', 'hello-plus' ),
963 'type' => Controls_Manager::SLIDER,
964 'size_units' => [ 'px' ],
965 'range' => [
966 'px' => [
967 'min' => 0,
968 'max' => 10,
969 'step' => 1,
970 ],
971 ],
972 'default' => [
973 'size' => 1,
974 'unit' => 'px',
975 ],
976 'selectors' => [
977 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-box-border-width: {{SIZE}}{{UNIT}};',
978 ],
979 'condition' => [
980 'show_box_border' => 'yes',
981 ],
982 ]
983 );
984
985 $this->add_control(
986 'box_border_color',
987 [
988 'label' => esc_html__( 'Color', 'hello-plus' ),
989 'type' => Controls_Manager::COLOR,
990 'global' => [
991 'default' => Global_Colors::COLOR_TEXT,
992 ],
993 'selectors' => [
994 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-box-border-color: {{VALUE}}',
995 ],
996 'condition' => [
997 'show_box_border' => 'yes',
998 ],
999 ]
1000 );
1001
1002 $this->add_responsive_control(
1003 'box_shape',
1004 [
1005 'label' => esc_html__( 'Shape', 'hello-plus' ),
1006 'type' => Controls_Manager::SELECT,
1007 'default' => 'sharp',
1008 'options' => [
1009 'sharp' => esc_html__( 'Sharp', 'hello-plus' ),
1010 'rounded' => esc_html__( 'Rounded', 'hello-plus' ),
1011 'custom' => esc_html__( 'Custom', 'hello-plus' ),
1012 ],
1013 'frontend_available' => true,
1014 ]
1015 );
1016
1017 $this->add_responsive_control(
1018 'box_shape_custom',
1019 [
1020 'label' => esc_html__( 'Border Radius', 'hello-plus' ),
1021 'type' => Controls_Manager::DIMENSIONS,
1022 'size_units' => [ 'px', '%', 'em', 'rem' ],
1023 'selectors' => [
1024 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-box-border-radius-custom-block-end: {{BOTTOM}}{{UNIT}}; --flex-hero-box-border-radius-custom-block-start: {{TOP}}{{UNIT}}; --flex-hero-box-border-radius-custom-inline-end: {{RIGHT}}{{UNIT}}; --flex-hero-box-border-radius-custom-inline-start: {{LEFT}}{{UNIT}};',
1025 ],
1026 'condition' => [
1027 'box_shape' => 'custom',
1028 ],
1029 ]
1030 );
1031
1032 $this->add_group_control(
1033 Group_Control_Box_Shadow::get_type(),
1034 [
1035 'name' => 'box_box_shadow',
1036 'selector' => '{{WRAPPER}} .ehp-flex-hero',
1037 ]
1038 );
1039
1040 $this->add_responsive_control(
1041 'box_padding',
1042 [
1043 'label' => esc_html__( 'Padding', 'hello-plus' ),
1044 'type' => Controls_Manager::DIMENSIONS,
1045 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1046 'selectors' => [
1047 '{{WRAPPER}} .ehp-flex-hero' => '--flex-hero-box-padding-block-end: {{BOTTOM}}{{UNIT}}; --flex-hero-box-padding-block-start: {{TOP}}{{UNIT}}; --flex-hero-box-padding-inline-end: {{RIGHT}}{{UNIT}}; --flex-hero-box-padding-inline-start: {{LEFT}}{{UNIT}};',
1048 ],
1049 'default' => [
1050 'top' => '60',
1051 'right' => '60',
1052 'bottom' => '60',
1053 'left' => '60',
1054 'unit' => 'px',
1055 ],
1056 'separator' => 'before',
1057 ]
1058 );
1059
1060 $this->add_control(
1061 'box_full_screen_height',
1062 [
1063 'label' => esc_html__( 'Full Screen Height', 'hello-plus' ),
1064 'type' => Controls_Manager::SWITCHER,
1065 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
1066 'label_off' => esc_html__( 'No', 'hello-plus' ),
1067 'return_value' => 'yes',
1068 'default' => '',
1069 'tablet_default' => '',
1070 'mobile_default' => '',
1071 'separator' => 'before',
1072 ]
1073 );
1074
1075 $configured_breakpoints = $this->get_configured_breakpoints();
1076
1077 $this->add_control(
1078 'box_full_screen_height_controls',
1079 [
1080 'label' => esc_html__( 'Apply Full Screen Height on', 'hello-plus' ),
1081 'type' => Controls_Manager::SELECT2,
1082 'label_block' => true,
1083 'multiple' => true,
1084 'options' => $configured_breakpoints['devices_options'],
1085 'default' => $configured_breakpoints['active_devices'],
1086 'condition' => [
1087 'box_full_screen_height' => 'yes',
1088 ],
1089 ]
1090 );
1091
1092 $this->end_controls_section();
1093 }
1094 }
1095