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 / cta.php

cta.php in Hello Plus 1.2.0, at modules/content/widgets/cta.php

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