Plugin Directory

source: addon-elements-for-elementor-page-builder/trunk/modules/price-table/widgets/price-table.php

Last change on this file was 3107074, checked in by wpvibes, 10 months ago

Release 1.13.6

File size: 22.0 KB
Line 
1<?php
2namespace WTS_EAE\Modules\PriceTable\Widgets;
3
4use Elementor\Controls_Manager;
5use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
6use WTS_EAE\Base\EAE_Widget_Base;
7use Elementor\Group_Control_Typography;
8use Elementor\Group_Control_Border;
9use Elementor\Group_Control_Box_Shadow;
10use Elementor\Group_Control_Background;
11use Elementor\Icons_Manager;
12use Elementor\Repeater;
13use WTS_EAE\Classes\Helper;
14
15if ( ! defined( 'ABSPATH' ) ) {
16        exit; // Exit if accessed directly
17}
18
19class PriceTable extends EAE_Widget_Base {
20
21        public function get_name() {
22                return 'wts-pricetable';
23        }
24
25        public function get_title() {
26                return __( 'Price Table', 'wts-eae' );
27        }
28
29        public function get_icon() {
30                return 'eae-icon eae-price-table';
31        }
32
33        public function get_categories() {
34                return [ 'wts-eae' ];
35        }
36
37
38        protected function register_controls() {
39                $this->start_controls_section(
40                        'section_title',
41                        [
42                                'label' => __( 'Plan Heading', 'wts-eae' ),
43                        ]
44                );
45
46                $this->add_control(
47                        'heading',
48                        [
49                                'label'       => __( 'Heading', 'wts-eae' ),
50                                'type'        => Controls_Manager::TEXT,
51                                'dynamic'     => [
52                                        'active' => true,
53                                ],
54                                'placeholder' => __( 'Enter plan name', 'wts-eae' ),
55                                'default'     => __( 'Plan 1', 'wts-eae' ),
56                        ]
57                );
58
59                $this->add_control(
60                        'heading_tag',
61                        [
62                                'label'   => __( 'Heading HTML Tag', 'wts-eae' ),
63                                'type'    => Controls_Manager::SELECT,
64                                'options' => [
65                                        'h1' => __( 'H1', 'wts-eae' ),
66                                        'h2' => __( 'H2', 'wts-eae' ),
67                                        'h3' => __( 'H3', 'wts-eae' ),
68                                        'h4' => __( 'H4', 'wts-eae' ),
69                                        'h5' => __( 'H5', 'wts-eae' ),
70                                        'h6' => __( 'H6', 'wts-eae' ),
71                                ],
72                                'default' => 'h2',
73                        ]
74                );
75
76                $this->add_control(
77                        'sub-heading',
78                        [
79                                'label'       => __( 'Sub Heading', 'wts-eae' ),
80                                'type'        => Controls_Manager::TEXT,
81                                'dynamic'     => [
82                                        'active' => true,
83                                ],
84                                'placeholder' => __( 'Enter plan name', 'wts-eae' ),
85                                'default'     => __( 'Plan 1', 'wts-eae' ),
86                        ]
87                );
88
89                $this->add_control(
90                        'sub_heading_tag',
91                        [
92                                'label'   => __( 'Sub Heading HTML Tag', 'wts-eae' ),
93                                'type'    => Controls_Manager::SELECT,
94                                'options' => [
95                                        'h1' => __( 'H1', 'wts-eae' ),
96                                        'h2' => __( 'H2', 'wts-eae' ),
97                                        'h3' => __( 'H3', 'wts-eae' ),
98                                        'h4' => __( 'H4', 'wts-eae' ),
99                                        'h5' => __( 'H5', 'wts-eae' ),
100                                        'h6' => __( 'H6', 'wts-eae' ),
101                                        'p'  => __( 'P', 'wts-eae' ),
102                                ],
103                                'default' => 'h3',
104                        ]
105                );
106
107                $this->end_controls_section();
108
109                $this->start_controls_section(
110                        'section_price_box',
111                        [
112                                'label' => __( 'Price Box', 'wts-eae' ),
113                        ]
114                );
115
116                $this->add_control(
117                        'price-box-text',
118                        [
119                                'label'       => __( 'Price Box Text', 'wts-eae' ),
120                                'type'        => Controls_Manager::TEXT,
121                                'dynamic'     => [
122                                        'active' => true,
123                                ],
124                                'placeholder' => __( '$100', 'wts-eae' ),
125                                'default'     => __( '$100', 'wts-eae' ),
126                        ]
127                );
128
129                $this->add_control(
130                        'price-box-subtext',
131                        [
132                                'label'       => __( 'Price Box Sub Text', 'wts-eae' ),
133                                'type'        => Controls_Manager::TEXT,
134                                'dynamic'     => [
135                                        'active' => true,
136                                ],
137                                'placeholder' => __( 'per month', 'wts-eae' ),
138                                'default'     => __( 'per month', 'wts-eae' ),
139                        ]
140                );
141
142                $this->add_control(
143                        'shape',
144                        [
145                                'label'        => __( 'Shape', 'wts-eae' ),
146                                'type'         => Controls_Manager::SELECT,
147                                'options'      => [
148                                        'none'   => __( 'None', 'wts-eae' ),
149                                        'circle' => __( 'Circle', 'wts-eae' ),
150                                        'square' => __( 'Square', 'wts-eae' ),
151                                ],
152                                'default'      => 'circle',
153                                'prefix_class' => 'eae-pt-price-box-shape-',
154                        ]
155                );
156
157                $this->end_controls_section();
158
159                $this->start_controls_section(
160                        'section_features',
161                        [
162                                'label' => __( 'Features', 'wts-eae' ),
163                        ]
164                );
165
166                $repeater = new Repeater();
167
168                $repeater->add_control(
169                        'text',
170                        [
171                                'label'       => __( 'Text', 'wts-eae' ),
172                                'type'        => Controls_Manager::TEXT,
173                                'dynamic'     => [
174                                        'active' => true,
175                                ],
176                                'label_block' => true,
177                                'placeholder' => __( 'Plan Features', 'wts-eae' ),
178                                'default'     => __( 'Feature 1', 'wts-eae' ),
179                        ]
180                );
181
182                $repeater->add_control(
183                        'available',
184                        [
185                                'label'       => __( 'Included', 'wts-eae' ),
186                                'type'        => Controls_Manager::SWITCHER,
187                                'label_block' => true,
188                                'default'     => 'yes',
189                        ]
190                );
191
192                $this->add_control(
193                        'feature-list',
194                        [
195                                'label'       => __( 'Plan Features', 'wts-eae' ),
196                                'type'        => Controls_Manager::REPEATER,
197                                'fields'      => $repeater->get_controls(),
198                                'default'     => [
199                                        [
200                                                'text'      => __( 'List Item #1', 'wts-eae' ),
201                                                'available' => 'yes',
202                                        ],
203                                        [
204                                                'text'      => __( 'List Item #2', 'wts-eae' ),
205                                                'available' => 'yes',
206                                        ],
207                                        [
208                                                'text'      => __( 'List Item #3', 'wts-eae' ),
209                                                'available' => 'yes',
210                                        ],
211                                ],
212
213                                'title_field' => '{{{ text }}}',
214                        ]
215                );
216
217                $this->end_controls_section();
218
219                $this->start_controls_section(
220                        'section_action_button',
221                        [
222                                'label' => __( 'Action Button', 'wts-eae' ),
223                        ]
224                );
225
226                $this->add_control(
227                        'action_text',
228                        [
229                                'label'       => __( 'Button Text', 'wts-eae' ),
230                                'type'        => Controls_Manager::TEXT,
231                                'dynamic'     => [
232                                        'active' => true,
233                                ],
234                                'placeholder' => __( 'Buy', 'wts-eae' ),
235                                'default'     => __( 'Buy Now', 'wts-eae' ),
236                        ]
237                );
238
239                $this->add_control(
240                        'link',
241                        [
242                                'label'       => __( 'Link to', 'wts-eae' ),
243                                'type'        => Controls_Manager::URL,
244                                'dynamic'     => [
245                                        'active' => true,
246                                ],
247                                'placeholder' => __( 'http://your-link.com', 'wts-eae' ),
248                                'separator'   => 'before',
249                        ]
250                );
251
252                $this->add_control(
253                        'icon_new',
254                        [
255                                'label'            => __( 'Icon', 'wts-eae' ),
256                                'type'             => Controls_Manager::ICONS,
257                                'label_block'      => true,
258                                'fa4compatibility' => 'icon',
259                                'default'          => [
260                                        'value'   => 'fa fa-shopping-cart',
261                                        'library' => 'fa-solid',
262                                ],
263                        ]
264                );
265
266                $this->add_control(
267                        'icon_align',
268                        [
269                                'label'   => __( 'Icon Position', 'wts-eae' ),
270                                'type'    => Controls_Manager::SELECT,
271                                'default' => 'left',
272                                'options' => [
273                                        'left'  => __( 'Before', 'wts-eae' ),
274                                        'right' => __( 'After', 'wts-eae' ),
275                                ],
276
277                        ]
278                );
279
280                $this->add_control(
281                        'icon_indent',
282                        [
283                                'label'     => __( 'Icon Spacing', 'wts-eae' ),
284                                'type'      => Controls_Manager::SLIDER,
285                                'range'     => [
286                                        'px' => [
287                                                'max' => 50,
288                                        ],
289                                ],
290                                'default'   => [
291                                        'unit' => 'px',
292                                        'size' => 5,
293                                ],
294
295                                'selectors' => [
296                                        '{{WRAPPER}} .eae-pt-action-button .eae-pt-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};',
297                                        '{{WRAPPER}} .eae-pt-action-button .eae-pt-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};',
298                                ],
299                        ]
300                );
301
302                $this->end_controls_section();
303
304                $this->start_controls_section(
305                        'section-box-style',
306                        [
307                                'label' => __( 'Box Style', 'wts-eae' ),
308                                'tab'   => Controls_Manager::TAB_STYLE,
309                        ]
310                );
311
312                $this->add_control(
313                        'box-color',
314                        [
315                                'label'     => __( 'Box Color', 'wts-eae' ),
316                                'type'      => Controls_Manager::COLOR,
317                                'default'   => '#93C64F',
318                                'selectors' => [
319                                        '{{WRAPPER}} .wts-price-box-wrapper' => 'background-color: {{VALUE}};',
320                                ],
321                        ]
322                );
323
324                $this->add_group_control(
325                        Group_Control_Border::get_type(),
326                        [
327                                'name'        => 'box_border',
328                                'label'       => __( 'Box Border', 'wts-eae' ),
329                                'placeholder' => '1px',
330                                'default'     => '1px',
331                                'selector'    => '{{WRAPPER}} .wts-price-box-wrapper',
332                        ]
333                );
334
335                $this->add_control(
336                        'box-border-radius',
337                        [
338                                'label'      => __( 'Border Radius', 'wts-eae' ),
339                                'type'       => Controls_Manager::DIMENSIONS,
340                                'size_units' => [ 'px', '%' ],
341                                'selectors'  => [
342                                        '{{WRAPPER}} .wts-price-box-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
343                                        '{{WRAPPER}} .wts-price-box-wrapper > div:first-child' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0 0;',
344                                        '{{WRAPPER}} .wts-price-box-wrapper > div:last-child' => 'border-radius: 0 0  {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
345                                ],
346                        ]
347                );
348
349                $this->add_group_control(
350                        Group_Control_Box_Shadow::get_type(),
351                        [
352                                'name'     => 'box_box_shadow',
353                                'selector' => '{{WRAPPER}} .wts-price-box-wrapper',
354                        ]
355                );
356
357                $this->end_controls_section();
358
359                $this->start_controls_section(
360                        'section-plan-heading-style',
361                        [
362                                'label' => __( 'Plan Heading', 'wts-eae' ),
363                                'tab'   => Controls_Manager::TAB_STYLE,
364                        ]
365                );
366
367                $this->add_control(
368                        'plan_heading_color',
369                        [
370                                'label'     => __( 'Heading Color', 'wts-eae' ),
371                                'type'      => Controls_Manager::COLOR,
372                                'default'   => '#FFF',
373                                'selectors' => [
374                                        '{{WRAPPER}} .eae-pt-heading' => 'color: {{VALUE}};',
375                                ],
376                        ]
377                );
378
379                $this->add_group_control(
380                        Group_Control_Typography::get_type(),
381                        [
382                                'name'     => 'plan_heading_typography',
383                                'global'   => [
384                                        'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
385                                ],
386                                'selector' => '{{WRAPPER}} .eae-pt-heading',
387                        ]
388                );
389
390                $this->add_control(
391                        'plan_sub_heading_color',
392                        [
393                                'label'     => __( 'Sub Heading Color', 'wts-eae' ),
394                                'type'      => Controls_Manager::COLOR,
395                                'default'   => '#FFF',
396                                'selectors' => [
397                                        '{{WRAPPER}} .eae-pt-sub-heading' => 'color: {{VALUE}};',
398                                ],
399                        ]
400                );
401
402                $this->add_group_control(
403                        Group_Control_Typography::get_type(),
404                        [
405                                'name'     => 'plan_sub_heading_typography',
406                                'global'   => [
407                                        'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
408                                ],
409                                'selector' => '{{WRAPPER}} .eae-pt-sub-heading',
410                        ]
411                );
412
413                $this->add_group_control(
414                        Group_Control_Background::get_type(),
415                        [
416                                'name'     => 'heading_section_bg',
417                                'label'    => __( 'Section Background', 'wts-eae' ),
418                                'types'    => [ 'classic', 'gradient' ],
419                                'selector' => '{{WRAPPER}} .heading-wrapper',
420                        ]
421                );
422
423                $this->end_controls_section();
424
425                $this->start_controls_section(
426                        'section-price-box',
427                        [
428                                'label' => __( 'Price Box', 'wts-eae' ),
429                                'tab'   => Controls_Manager::TAB_STYLE,
430                        ]
431                );
432
433                $this->add_control(
434                        'pb_content_settings',
435                        [
436                                'label'     => __( 'Content Settings', 'wts-eae' ),
437                                'type'      => Controls_Manager::HEADING,
438                                'separator' => 'before',
439                        ]
440                );
441
442                $this->add_control(
443                        'price_text_color',
444                        [
445                                'label'     => __( 'Price Text Color', 'wts-eae' ),
446                                'type'      => Controls_Manager::COLOR,
447                                'default'   => '#FFF',
448                                'selectors' => [
449                                        '{{WRAPPER}} .plan-price-shape-inner .price-text' => 'color: {{VALUE}};',
450                                ],
451                        ]
452                );
453
454                $this->add_group_control(
455                        Group_Control_Typography::get_type(),
456                        [
457                                'name'     => 'price_text_typography',
458                                'selector' => '{{WRAPPER}} .plan-price-shape-inner .price-text',
459                        ]
460                );
461
462                $this->add_control(
463                        'price_sub_text_color',
464                        [
465                                'label'     => __( 'Sub Text Color', 'wts-eae' ),
466                                'type'      => Controls_Manager::COLOR,
467                                'default'   => '#FFF',
468                                'selectors' => [
469                                        '{{WRAPPER}} .plan-price-shape-inner .price-subtext' => 'color: {{VALUE}};',
470                                ],
471                        ]
472                );
473
474                $this->add_group_control(
475                        Group_Control_Typography::get_type(),
476                        [
477                                'name'     => 'price_sub_text_typography',
478
479                                'selector' => '{{WRAPPER}} .plan-price-shape-inner .price-subtext',
480                        ]
481                );
482
483                $this->add_control(
484                        'pb_box_settings',
485                        [
486                                'label'     => __( 'Box Settings', 'wts-eae' ),
487                                'type'      => Controls_Manager::HEADING,
488                                'separator' => 'before',
489                        ]
490                );
491
492                $this->add_group_control(
493                        Group_Control_Border::get_type(),
494                        [
495                                'name'     => 'price_box_border',
496                                'label'    => __( 'Price Box Border', 'wts-eae' ),
497                                'selector' => '{{WRAPPER}} .plan-price-shape',
498                        ]
499                );
500
501                $this->add_control(
502                        'price_box_border_radius',
503                        [
504                                'label'      => __( 'Border Radius', 'wts-eae' ),
505                                'type'       => Controls_Manager::DIMENSIONS,
506                                'size_units' => [ 'px', '%' ],
507                                'selectors'  => [
508                                        '{{WRAPPER}} .plan-price-shape' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
509                                ],
510                        ]
511                );
512
513                $this->add_responsive_control(
514                        'price_box_padding',
515                        [
516                                'label'      => __( 'Price Box Padding', 'wts-eae' ),
517                                'type'       => Controls_Manager::DIMENSIONS,
518                                'size_units' => [ 'px', 'em', '%' ],
519                                'selectors'  => [
520                                        '{{WRAPPER}} .plan-price-shape-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
521                                ],
522                        ]
523                );
524
525                $this->add_group_control(
526                        Group_Control_Background::get_type(),
527                        [
528                                'name'     => 'price_box_section_bg',
529                                'label'    => __( 'Section Background', 'wts-eae' ),
530                                'types'    => [ 'classic', 'gradient' ],
531                                'selector' => '{{WRAPPER}} .plan-price-block',
532                        ]
533                );
534
535                $this->end_controls_section();
536
537                $this->start_controls_section(
538                        'section-features-style',
539                        [
540                                'label' => __( 'Feature List', 'wts-eae' ),
541                                'tab'   => Controls_Manager::TAB_STYLE,
542                        ]
543                );
544
545                $this->add_control(
546                        'features_text_color',
547                        [
548                                'label'     => __( 'Features Color', 'wts-eae' ),
549                                'type'      => Controls_Manager::COLOR,
550                                'default'   => '#FFF',
551                                'selectors' => [
552                                        '{{WRAPPER}} .eae-pt-feature-list li' => 'color: {{VALUE}};',
553                                ],
554                        ]
555                );
556
557                $this->add_group_control(
558                        Group_Control_Typography::get_type(),
559                        [
560                                'name'     => 'features_typography',
561                                'global'   => [
562                                        'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
563                                ],
564                                'selector' => '{{WRAPPER}} .eae-pt-feature-list li',
565                        ]
566                );
567
568                $this->add_group_control(
569                        Group_Control_Background::get_type(),
570                        [
571                                'name'     => 'feature_section_bg',
572                                'label'    => __( 'Section Background', 'wts-eae' ),
573                                'types'    => [ 'classic', 'gradient' ],
574                                'selector' => '{{WRAPPER}} .plan-features-wrapper',
575                        ]
576                );
577
578                $this->add_responsive_control(
579                        'feature_align',
580                        [
581                                'label'     => __( 'Alignment', 'wts-eae' ),
582                                'type'      => Controls_Manager::CHOOSE,
583                                'options'   => [
584                                        'left' => [
585                                                'title' => __( 'Left', 'wts-eae' ),
586                                                'icon'  => 'fa fa-align-left',
587                                        ],
588                                        'center' => [
589                                                'title' => __( 'Center', 'wts-eae' ),
590                                                'icon'  => 'fa fa-align-center',
591                                        ],
592                                        'right' => [
593                                                'title' => __( 'Right', 'wts-eae' ),
594                                                'icon'  => 'fa fa-align-right',
595                                        ],
596                                ],
597                                'default'   => 'center',
598                                'selectors' => [
599                                        '{{WRAPPER}} .plan-features-wrapper .eae-pt-feature-list' => 'text-align: {{VALUE}};',
600                                ],
601                        ]
602                );
603
604                $this->add_responsive_control(
605                        'feature_padding',
606                        [
607                                'label'      => __( 'Padding', 'wts-eae' ),
608                                'type'       => Controls_Manager::DIMENSIONS,
609                                'size_units' => [ 'px', 'em', '%' ],
610                                'selectors'  => [
611                                        '{{WRAPPER}} .plan-features-wrapper .eae-pt-feature-list li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
612                                ],
613                        ]
614                );
615
616                $this->end_controls_section();
617
618                $this->start_controls_section(
619                        'section-action-button',
620                        [
621                                'label' => __( 'Action Button', 'wts-eae' ),
622                                'tab'   => Controls_Manager::TAB_STYLE,
623                        ]
624                );
625
626                $this->add_control(
627                        'button-section-bg',
628                        [
629                                'label'     => __( 'Section Background', 'wts-eae' ),
630                                'type'      => Controls_Manager::COLOR,
631                                'default'   => '#333333',
632                                'selectors' => [
633                                        '{{WRAPPER}} .eae-pt-button-wrapper' => 'background-color: {{VALUE}};',
634                                ],
635                        ]
636                );
637
638                $this->add_control(
639                        'button_text_color',
640                        [
641                                'label'     => __( 'Text Color', 'wts-eae' ),
642                                'type'      => Controls_Manager::COLOR,
643                                'default'   => '#fff',
644                                'selectors' => [
645                                        '{{WRAPPER}} .eae-pt-action-button' => 'color: {{VALUE}};',
646                                        '{{WRAPPER}} .eae-pt-action-button svg' => 'fill: {{VALUE}};',
647                                ],
648                        ]
649                );
650
651                $this->add_group_control(
652                        Group_Control_Typography::get_type(),
653                        [
654                                'name'     => 'typography',
655                                'label'    => __( 'Typography', 'wts-eae' ),
656                                'global'   => [
657                                        'default' => Global_Typography::TYPOGRAPHY_ACCENT,
658                                ],
659                                'selector' => '{{WRAPPER}} .eae-pt-action-button',
660                        ]
661                );
662
663                $this->add_control(
664                        'background_color',
665                        [
666                                'label'     => __( 'Background Color', 'wts-eae' ),
667                                'type'      => Controls_Manager::COLOR,
668                                'default'   => '#93C64F',
669                                'selectors' => [
670                                        '{{WRAPPER}} .eae-pt-action-button' => 'background-color: {{VALUE}};',
671                                ],
672                        ]
673                );
674
675                $this->add_group_control(
676                        Group_Control_Background::get_type(),
677                        [
678                                'name'     => 'action_section_bg',
679                                'label'    => __( 'Section Background', 'wts-eae' ),
680                                'types'    => [ 'classic', 'gradient' ],
681                                'selector' => '{{WRAPPER}} .eae-pt-button-wrapper',
682                                'default'  => [
683                                        'background' => 'classic',
684                                        'color'      => '#555',
685                                ],
686                        ]
687                );
688
689                $this->add_group_control(
690                        Group_Control_Border::get_type(),
691                        [
692                                'name'        => 'border',
693                                'label'       => __( 'Border', 'wts-eae' ),
694                                'placeholder' => '1px',
695                                'default'     => '1px',
696                                'selector'    => '{{WRAPPER}} .eae-pt-action-button',
697                        ]
698                );
699
700                $this->add_control(
701                        'border_radius',
702                        [
703                                'label'      => __( 'Border Radius', 'wts-eae' ),
704                                'type'       => Controls_Manager::DIMENSIONS,
705                                'size_units' => [ 'px', '%' ],
706                                'selectors'  => [
707                                        '{{WRAPPER}} .eae-pt-action-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
708                                ],
709                        ]
710                );
711
712                $this->add_control(
713                        'text_padding',
714                        [
715                                'label'      => __( 'Text Padding', 'wts-eae' ),
716                                'type'       => Controls_Manager::DIMENSIONS,
717                                'size_units' => [ 'px', 'em', '%' ],
718                                'selectors'  => [
719                                        '{{WRAPPER}} .eae-pt-action-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
720                                ],
721                        ]
722                );
723
724                $this->end_controls_section();
725
726                $this->start_controls_section(
727                        'section_hover',
728                        [
729                                'label' => __( 'Button Hover', 'wts-eae' ),
730                                'type'  => Controls_Manager::SECTION,
731                                'tab'   => Controls_Manager::TAB_STYLE,
732                        ]
733                );
734
735                $this->add_control(
736                        'hover_color',
737                        [
738                                'label'     => __( 'Text Color', 'wts-eae' ),
739                                'type'      => Controls_Manager::COLOR,
740                                'selectors' => [
741                                        '{{WRAPPER}} .eae-pt-action-button:hover' => 'color: {{VALUE}};',
742                                        '{{WRAPPER}} .eae-pt-action-button:hover svg' => 'fill: {{VALUE}};',
743                                ],
744                        ]
745                );
746
747                $this->add_control(
748                        'button_background_hover_color',
749                        [
750                                'label'     => __( 'Background Color', 'wts-eae' ),
751                                'type'      => Controls_Manager::COLOR,
752                                'selectors' => [
753                                        '{{WRAPPER}} .eae-pt-action-button:hover' => 'background-color: {{VALUE}};',
754                                ],
755                        ]
756                );
757
758                $this->add_control(
759                        'button_hover_border_color',
760                        [
761                                'label'     => __( 'Border Color', 'wts-eae' ),
762                                'type'      => Controls_Manager::COLOR,
763                                'condition' => [
764                                        'border_border!' => '',
765                                ],
766                                'selectors' => [
767                                        '{{WRAPPER}} .eae-pt-action-button:hover' => 'border-color: {{VALUE}};',
768                                ],
769                        ]
770                );
771
772                $this->end_controls_section();
773        }
774
775        protected function render() {
776                $settings = $this->get_settings_for_display();
777                $this->add_render_attribute( 'heading', 'class', 'eae-pt-heading' );
778                $this->add_render_attribute( 'sub_heading', 'class', 'eae-pt-sub-heading' );
779                $this->add_render_attribute( 'button', 'class', 'eae-pt-action-button' );
780                $this->add_render_attribute( 'icon-align', 'class', 'eae-pt-align-icon-' . esc_attr( $settings['icon_align'] ) );
781
782                if ( ! empty( $settings['link']['url'] ) ) {
783                        $this->add_link_attributes( 'button', $settings['link'] );
784                }
785
786                $icon_migrated = isset( $settings['__fa4_migrated']['icon_new'] );
787                $icon_is_new   = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
788
789                ?>
790                <div class="wts-price-box-wrapper">
791                <?php
792                if ( ! empty( $settings['heading'] ) || ! empty( $settings['heading'] ) ) {
793                        ?>
794                        <div class="heading-wrapper">
795                        <?php
796                        if ( ! empty( $settings['heading'] ) ) {
797                                printf(
798                                        '<%1$s %2$s>%3$s</%1$s>',
799                                        Helper::validate_html_tag( $settings['heading_tag'], [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ], 'h2' ),
800                                        $this->get_render_attribute_string( 'heading' ),
801                                        Helper::eae_wp_kses($settings['heading'])
802                                );
803                        }
804                        ?>
805
806                        <?php
807                        if ( ! empty( $settings['sub-heading'] ) ) {
808                                printf(
809                                        '<%1$s %2$s>%3$s</%1$s>',
810                                        Helper::validate_html_tag( $settings['sub_heading_tag'], [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ], 'h3' ),
811                                        $this->get_render_attribute_string( 'sub_heading' ),
812                                        Helper::eae_wp_kses($settings['sub-heading'])
813                                );
814                        }
815                        ?>
816                        </div>
817                        <?php
818                }
819
820                if ( ! empty( $settings['price-box-text'] ) || ! empty( $settings['price-box-subtext'] ) ) {
821                        ?>
822                        <div class="plan-price-block">
823                                <div class="plan-price-shape">
824                                        <div class="plan-price-shape-inner">
825                                                <?php if ( ! empty( $settings['price-box-text'] ) ) { ?>
826                                                        <span class="price-text"><?php echo Helper::eae_wp_kses($settings['price-box-text']); ?></span>
827                                                <?php } ?>
828
829                                                <?php if ( ! empty( $settings['price-box-subtext'] ) ) { ?>
830                                                        <span class="price-subtext"><?php echo Helper::eae_wp_kses($settings['price-box-subtext']); ?></span>
831                                                <?php } ?>
832                                        </div>
833                                </div>
834                        </div>
835
836                        <?php
837                }
838
839                if ( count( $settings['feature-list'] ) ) {
840                        ?>
841                        <div class="plan-features-wrapper">
842                                <ul class="eae-pt-feature-list">
843                                        <?php
844                                        foreach ( $settings['feature-list'] as $feature ) {
845                                                ?>
846                                                <li class="<?php echo esc_attr(( $feature['available'] === 'yes' ) ? '' : 'strike-feature'); ?>"><?php echo Helper::eae_wp_kses($feature['text']); ?></li>
847                                                <?php
848                                        }
849                                        ?>
850                                </ul>
851                        </div>
852                        <?php
853                }
854
855                if ( ! empty( $settings['action_text'] ) ) {
856                        ?>
857                        <div class="eae-pt-button-wrapper">
858                                <a <?php echo $this->get_render_attribute_string( 'button' ); ?>>
859                                        <span <?php echo $this->get_render_attribute_string( 'content-wrapper' ); ?>>
860                                                <?php if ( ! empty( $settings['icon_new'] ) ) : ?>
861                                                <span <?php echo $this->get_render_attribute_string( 'icon-align' ); ?>>
862                                                        <?php
863                                                        if ( $icon_migrated || $icon_is_new ) :
864                                                                Icons_Manager::render_icon( $settings['icon_new'], [ 'aria-hidden' => 'true' ] );
865                                                        else :
866                                                                ?>
867                                                                <i class="<?php echo esc_attr($settings['icon']); ?>"></i>
868                                                        <?php endif; ?>
869                                                </span>
870                                                <?php endif; ?>
871                                                <span class="elementor-button-text"><?php echo Helper::eae_wp_kses($settings['action_text']); ?></span>
872                                        </span>
873                                </a>
874                        </div>
875                        <?php
876                }
877                ?>
878                </div> <!-- close .wts-price-box-wrapper -->
879                <?php
880        }
881
882        public function on_import( $element ) {
883                return Icons_Manager::on_import_migration( $element, 'icon', 'icon_new' );
884        }
885
886}
Note: See TracBrowser for help on using the repository browser.