PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 2.0.3
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v2.0.3
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / modules / featured-box / widgets / featured-box.php

featured-box.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 2.0.3, at modules/featured-box/widgets/featured-box.php

1,144 lines 37.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimateStoreKit\Modules\FeaturedBox\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Image_Size;
10 use Elementor\Group_Control_Typography;
11 use Elementor\Utils;
12 use UltimateStoreKit\Base\Module_Base;
13
14 if (!defined('ABSPATH')) {
15 exit;
16 } // Exit if accessed directly
17
18 class Featured_Box extends Module_Base {
19
20 public function get_name() {
21 return 'usk-featured-box';
22 }
23
24 public function get_title() {
25 return esc_html__('Featured Box', 'ultimate-store-kit');
26 }
27
28 public function get_icon() {
29 return 'usk-widget-icon usk-icon-featured-box';
30 }
31
32 public function get_categories() {
33 return ['ultimate-store-kit'];
34 }
35
36 public function get_keywords() {
37 return ['services', 'list', 'featured', 'box', 'info', 'featured box'];
38 }
39
40 public function get_style_depends() {
41 if ($this->usk_is_edit_mode()) {
42 return ['usk-styles'];
43 } else {
44 return ['usk-featured-box'];
45 }
46 }
47
48 // public function get_custom_help_url() {
49 // return 'https://youtu.be/a_wJL950Kz4';
50 // }
51
52 protected function register_controls() {
53
54 $this->start_controls_section(
55 'section_layout',
56 [
57 'label' => __('Layout', 'ultimate-store-kit'),
58 'tab' => Controls_Manager::TAB_CONTENT,
59 ]
60 );
61
62 $this->start_controls_tabs('tabs_layout');
63 $this->start_controls_tab(
64 'tab_content',
65 [
66 'label' => __('Content', 'ultimate-store-kit'),
67 ]
68 );
69
70 $this->add_control(
71 'title',
72 [
73 'label' => __('Title', 'ultimate-store-kit'),
74 'type' => Controls_Manager::TEXT,
75 'dynamic' => [
76 'active' => true,
77 ],
78 'default' => esc_html__('New Featured Box', 'ultimate-store-kit'),
79 'placeholder' => __('Enter your title', 'ultimate-store-kit'),
80 'label_block' => true,
81 'condition' => [
82 'show_title' => 'yes',
83 ],
84 ]
85 );
86
87 $this->add_control(
88 'meta',
89 [
90 'label' => esc_html__('Meta Text', 'ultimate-store-kit'),
91 'type' => Controls_Manager::TEXT,
92 'label_block' => true,
93 'dynamic' => ['active' => true],
94 'default' => esc_html__('Monthly Discount', 'ultimate-store-kit'),
95 'condition' => [
96 'show_meta' => 'yes',
97 ],
98 ]
99 );
100
101 $this->add_control(
102 'readmore_text',
103 [
104 'label' => esc_html__('Button Text', 'ultimate-store-kit'),
105 'type' => Controls_Manager::TEXT,
106 'default' => esc_html__('Shop Now', 'ultimate-store-kit'),
107 'label_block' => true,
108 'dynamic' => ['active' => true],
109 'condition' => [
110 'show_readmore' => 'yes',
111 ],
112 ]
113 );
114
115 $this->add_control(
116 'readmore_link',
117 [
118 'label' => esc_html__('Button Link', 'ultimate-store-kit'),
119 'type' => Controls_Manager::URL,
120 'dynamic' => ['active' => true],
121 'placeholder' => 'http://your-link.com',
122 'default' => [
123 'url' => '#',
124 ],
125 'condition' => [
126 'show_readmore' => 'yes',
127 ],
128 ]
129 );
130 $this->add_responsive_control(
131 'image',
132 [
133 'label' => __('Image', 'ultimate-store-kit'),
134 'type' => Controls_Manager::MEDIA,
135 'default' => [
136 'url' => Utils::get_placeholder_image_src(),
137 ],
138 'selectors' => [
139 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-image: url("{{URL}}");',
140 ],
141 'has_sizes' => true,
142 'render_type' => 'template',
143 ]
144 );
145 $this->add_responsive_control(
146 'position',
147 [
148 'label' => esc_html__( 'Position', 'elementor' ),
149 'type' => Controls_Manager::SELECT,
150 'default' => '',
151 'separator' => 'before',
152 'options' => [
153 '' => esc_html__( 'Default', 'elementor' ),
154 'center center' => esc_html__( 'Center Center', 'elementor' ),
155 'center left' => esc_html__( 'Center Left', 'elementor' ),
156 'center right' => esc_html__( 'Center Right', 'elementor' ),
157 'top center' => esc_html__( 'Top Center', 'elementor' ),
158 'top left' => esc_html__( 'Top Left', 'elementor' ),
159 'top right' => esc_html__( 'Top Right', 'elementor' ),
160 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
161 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
162 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
163 'initial' => esc_html__( 'Custom', 'elementor' ),
164
165 ],
166 'selectors' => [
167 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-position: {{VALUE}};',
168 ],
169 'condition' => [
170 'image[url]!' => '',
171 ],
172 ]
173 );
174
175 $this->add_responsive_control(
176 'xpos',
177 [
178 'label' => esc_html__( 'X Position', 'elementor' ),
179 'type' => Controls_Manager::SLIDER,
180 'responsive' => true,
181 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
182 'default' => [
183 'size' => 0,
184 ],
185 'tablet_default' => [
186 'size' => 0,
187 ],
188 'mobile_default' => [
189 'size' => 0,
190 ],
191 'range' => [
192 'px' => [
193 'min' => -800,
194 'max' => 800,
195 ],
196 'em' => [
197 'min' => -100,
198 'max' => 100,
199 ],
200 '%' => [
201 'min' => -100,
202 'max' => 100,
203 ],
204 'vw' => [
205 'min' => -100,
206 'max' => 100,
207 ],
208 ],
209 'selectors' => [
210 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
211 ],
212 'condition' => [
213 'position' => [ 'initial' ],
214 'image[url]!' => '',
215 ],
216 'required' => true,
217 ]
218 );
219
220 $this->add_responsive_control(
221 'ypos',
222 [
223 'label' => esc_html__( 'Y Position', 'elementor' ),
224 'type' => Controls_Manager::SLIDER,
225 'responsive' => true,
226 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
227 'default' => [
228 'size' => 0,
229 ],
230 'tablet_default' => [
231 'size' => 0,
232 ],
233 'mobile_default' => [
234 'size' => 0,
235 ],
236 'range' => [
237 'px' => [
238 'min' => -800,
239 'max' => 800,
240 ],
241 'em' => [
242 'min' => -100,
243 'max' => 100,
244 ],
245 '%' => [
246 'min' => -100,
247 'max' => 100,
248 ],
249 'vh' => [
250 'min' => -100,
251 'max' => 100,
252 ],
253 ],
254 'selectors' => [
255 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
256 ],
257 'condition' => [
258 'position' => [ 'initial' ],
259 'image[url]!' => '',
260 ],
261 'required' => true,
262 ]
263 );
264
265 $this->add_responsive_control(
266 'repeat',
267 [
268 'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ),
269 'type' => Controls_Manager::SELECT,
270 'default' => '',
271 'options' => [
272 '' => esc_html__( 'Default', 'elementor' ),
273 'no-repeat' => esc_html__( 'No-repeat', 'elementor' ),
274 'repeat' => esc_html__( 'Repeat', 'elementor' ),
275 'repeat-x' => esc_html__( 'Repeat-x', 'elementor' ),
276 'repeat-y' => esc_html__( 'Repeat-y', 'elementor' ),
277 ],
278 'selectors' => [
279 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-repeat: {{VALUE}};',
280 ],
281 'condition' => [
282 'image[url]!' => '',
283 ],
284 ]
285 );
286
287 $this->add_responsive_control(
288 'size',
289 [
290 'label' => esc_html__( 'Display Size', 'elementor' ),
291 'type' => Controls_Manager::SELECT,
292 'default' => '',
293 'options' => [
294 '' => esc_html__( 'Default', 'elementor' ),
295 'auto' => esc_html__( 'Auto', 'elementor' ),
296 'cover' => esc_html__( 'Cover', 'elementor' ),
297 'contain' => esc_html__( 'Contain', 'elementor' ),
298 'initial' => esc_html__( 'Custom', 'elementor' ),
299 ],
300 'selectors' => [
301 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-size: {{VALUE}};',
302 ],
303 'condition' => [
304 'image[url]!' => '',
305 ],
306 ]
307 );
308
309 $this->add_responsive_control(
310 'bg_width',
311 [
312 'label' => esc_html__( 'Width', 'elementor' ),
313 'type' => Controls_Manager::SLIDER,
314 'responsive' => true,
315 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
316 'range' => [
317 'px' => [
318 'max' => 1000,
319 ],
320 ],
321 'default' => [
322 'size' => 100,
323 'unit' => '%',
324 ],
325 'required' => true,
326 'selectors' => [
327 '{{WRAPPER}} .usk-featured-box .usk-image-wrap' => 'background-size: {{SIZE}}{{UNIT}} auto',
328
329 ],
330 'condition' => [
331 'size' => [ 'initial' ],
332 'image[url]!' => '',
333 ],
334 ]
335 );
336
337
338 $this->end_controls_tab();
339 $this->start_controls_tab(
340 'tab_optional',
341 [
342 'label' => __('Optional', 'ultimate-store-kit'),
343 ]
344 );
345
346 $this->add_control(
347 'title_link',
348 [
349 'label' => esc_html__('Title Link', 'ultimate-store-kit'),
350 'type' => Controls_Manager::URL,
351 'dynamic' => ['active' => true],
352 'placeholder' => 'http://your-link.com',
353 'condition' => [
354 'show_title' => 'yes',
355 ],
356 ]
357 );
358
359 $this->add_control(
360 'text',
361 [
362 'label' => esc_html__('Text', 'ultimate-store-kit'),
363 'type' => Controls_Manager::WYSIWYG,
364 'label_block' => true,
365 'dynamic' => ['active' => true],
366 'default' => esc_html__('Don\'t miss the last opportunity.', 'ultimate-store-kit'),
367 'condition' => [
368 'show_text' => 'yes',
369 ],
370 'separator' => 'before',
371 ]
372 );
373
374 $this->end_controls_tab();
375 $this->end_controls_tabs();
376 $this->end_controls_section();
377
378 $this->start_controls_section(
379 'section_additional_settings',
380 [
381 'label' => __('Additional Options', 'ultimate-store-kit'),
382 'tab' => Controls_Manager::TAB_CONTENT,
383 ]
384 );
385
386 $this->add_responsive_control(
387 'box_height',
388 [
389 'label' => esc_html__('Height', 'ultimate-store-kit'),
390 'type' => Controls_Manager::SLIDER,
391 'default' => [
392 'size' => 300,
393 ],
394 'range' => [
395 'px' => [
396 'min' => 200,
397 'max' => 800,
398 ],
399 ],
400 'selectors' => [
401 '{{WRAPPER}} .usk-featured-box .usk-item' => 'height: {{SIZE}}{{UNIT}};',
402 ],
403 ]
404 );
405
406 $this->add_responsive_control(
407 'content_width',
408 [
409 'label' => esc_html__('Content Width', 'ultimate-store-kit'),
410 'type' => Controls_Manager::SLIDER,
411 'default' => [
412 'size' => 500,
413 ],
414 'range' => [
415 'px' => [
416 'min' => 200,
417 'max' => 1200,
418 ],
419 ],
420 'selectors' => [
421 '{{WRAPPER}} .usk-featured-box .usk-content' => 'width: {{SIZE}}{{UNIT}};',
422 ],
423 ]
424 );
425
426 $this->add_control(
427 'content_position',
428 [
429 'label' => esc_html__('Content Position', 'ultimate-store-kit'),
430 'type' => Controls_Manager::CHOOSE,
431 'default' => 'center',
432 'options' => [
433 'top' => [
434 'title' => esc_html__('Top', 'ultimate-store-kit'),
435 'icon' => 'eicon-v-align-top',
436 ],
437 'center' => [
438 'title' => esc_html__('Center', 'ultimate-store-kit'),
439 'icon' => 'eicon-v-align-middle',
440 ],
441 'bottom' => [
442 'title' => esc_html__('Bottom', 'ultimate-store-kit'),
443 'icon' => 'eicon-v-align-bottom',
444 ],
445 ],
446 'toggle' => false,
447 ]
448 );
449
450 $this->add_responsive_control(
451 'alignment',
452 [
453 'label' => esc_html__('Alignment', 'ultimate-store-kit'),
454 'type' => Controls_Manager::CHOOSE,
455 'options' => [
456 'left' => [
457 'title' => esc_html__('Left', 'ultimate-store-kit'),
458 'icon' => 'eicon-h-align-left',
459 ],
460 'center' => [
461 'title' => esc_html__('Center', 'ultimate-store-kit'),
462 'icon' => 'eicon-h-align-center',
463 ],
464 'right' => [
465 'title' => esc_html__('Right', 'ultimate-store-kit'),
466 'icon' => 'eicon-h-align-right',
467 ],
468 ],
469 'selectors' => [
470 '{{WRAPPER}} .usk-featured-box .usk-content' => 'text-align: {{VALUE}}',
471 ],
472 ]
473 );
474
475 $this->add_control(
476 'show_title',
477 [
478 'label' => __('Show Title', 'ultimate-store-kit'),
479 'type' => Controls_Manager::SWITCHER,
480 'default' => 'yes',
481 'separator' => 'before',
482 ]
483 );
484
485 $this->add_control(
486 'title_tag',
487 [
488 'label' => __('Title HTML Tag', 'ultimate-store-kit'),
489 'type' => Controls_Manager::SELECT,
490 'default' => 'h3',
491 'options' => ultimate_store_kit_title_tags(),
492 'condition' => [
493 'show_title' => 'yes',
494 ],
495 ]
496 );
497
498 $this->add_control(
499 'show_text',
500 [
501 'label' => esc_html__('Show Text', 'ultimate-store-kit'),
502 'type' => Controls_Manager::SWITCHER,
503 'default' => 'yes',
504 'separator' => 'before',
505 ]
506 );
507
508 $this->add_control(
509 'show_meta',
510 [
511 'label' => esc_html__('Show Meta', 'ultimate-store-kit'),
512 'type' => Controls_Manager::SWITCHER,
513 'default' => 'yes',
514 ]
515 );
516
517 $this->add_control(
518 'show_readmore',
519 [
520 'label' => esc_html__('Show Button', 'ultimate-store-kit'),
521 'type' => Controls_Manager::SWITCHER,
522 'default' => 'yes',
523 ]
524 );
525
526 $this->add_control(
527 'show_wrapper_link',
528 [
529 'label' => esc_html__('Show Wrapper link', 'ultimate-store-kit'),
530 'type' => Controls_Manager::SWITCHER,
531 'separator' => 'before',
532 ]
533 );
534
535 $this->add_control(
536 'wrapper_link',
537 [
538 'label' => esc_html__('Wrapper Link', 'ultimate-store-kit'),
539 'type' => Controls_Manager::URL,
540 'dynamic' => ['active' => true],
541 'placeholder' => 'http://your-link.com',
542 'default' => [
543 'url' => '#',
544 ],
545 'condition' => [
546 'show_wrapper_link' => 'yes',
547 ],
548 ]
549 );
550
551 $this->end_controls_section();
552
553 //Style
554 $this->start_controls_section(
555 'section_style_items',
556 [
557 'label' => __('Featured Box', 'ultimate-store-kit'),
558 'tab' => Controls_Manager::TAB_STYLE,
559 ]
560 );
561
562 $this->start_controls_tabs('tabs_item_style');
563
564 $this->start_controls_tab(
565 'tab_item_normal',
566 [
567 'label' => esc_html__('Normal', 'ultimate-store-kit'),
568 ]
569 );
570
571 $this->add_group_control(
572 Group_Control_Background::get_type(),
573 [
574 'name' => 'item_background',
575 'selector' => '{{WRAPPER}} .usk-featured-box .usk-item',
576 ]
577 );
578
579 $this->add_group_control(
580 Group_Control_Border::get_type(),
581 [
582 'name' => 'item_border',
583 'label' => esc_html__('Border', 'ultimate-store-kit'),
584 // 'fields_options' => [
585 // 'border' => [
586 // 'default' => 'solid',
587 // ],
588 // 'width' => [
589 // 'default' => [
590 // 'top' => '1',
591 // 'right' => '1',
592 // 'bottom' => '1',
593 // 'left' => '1',
594 // 'isLinked' => false,
595 // ],
596 // ],
597 // 'color' => [
598 // 'default' => '#eee',
599 // ],
600 // ],
601 'selector' => '{{WRAPPER}} .usk-featured-box .usk-item',
602 'separator' => 'before',
603 ]
604 );
605
606 $this->add_responsive_control(
607 'item_border_radius',
608 [
609 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
610 'type' => Controls_Manager::DIMENSIONS,
611 'size_units' => ['px', 'em', '%'],
612 'selectors' => [
613 '{{WRAPPER}} .usk-featured-box .usk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
614 ],
615 ]
616 );
617
618 $this->add_responsive_control(
619 'item_padding',
620 [
621 'label' => esc_html__('Padding', 'ultimate-store-kit'),
622 'type' => Controls_Manager::DIMENSIONS,
623 'size_units' => ['px', 'em', '%'],
624 'selectors' => [
625 '{{WRAPPER}} .usk-featured-box .usk-item .usk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
626 ],
627 ]
628 );
629
630 $this->add_group_control(
631 Group_Control_Box_Shadow::get_type(),
632 [
633 'name' => 'item_box_shadow',
634 'selector' => '{{WRAPPER}} .usk-featured-box .usk-item',
635 ]
636 );
637
638 $this->end_controls_tab();
639
640 $this->start_controls_tab(
641 'tab_item_hover',
642 [
643 'label' => esc_html__('Hover', 'ultimate-store-kit'),
644 ]
645 );
646
647 $this->add_group_control(
648 Group_Control_Background::get_type(),
649 [
650 'name' => 'item_hover_background',
651 'selector' => '{{WRAPPER}} .usk-featured-box .usk-item:hover',
652 ]
653 );
654
655 $this->add_control(
656 'item_hover_border_color',
657 [
658 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
659 'type' => Controls_Manager::COLOR,
660 'default' => '#333',
661 'condition' => [
662 'item_border_border!' => '',
663 ],
664 'selectors' => [
665 '{{WRAPPER}} .usk-featured-box .usk-item:hover' => 'border-color: {{VALUE}};',
666 ],
667 'separator' => 'before',
668 ]
669 );
670
671 $this->add_group_control(
672 Group_Control_Box_Shadow::get_type(),
673 [
674 'name' => 'item_hover_box_shadow',
675 'selector' => '{{WRAPPER}} .usk-featured-box .usk-item:hover',
676 ]
677 );
678
679 $this->end_controls_tab();
680
681 $this->end_controls_tabs();
682
683 $this->end_controls_section();
684
685 $this->start_controls_section(
686 'section_title_style',
687 [
688 'label' => __('Title', 'ultimate-store-kit'),
689 'tab' => Controls_Manager::TAB_STYLE,
690 'condition' => [
691 'show_title' => 'yes',
692 ],
693 ]
694 );
695
696 $this->add_control(
697 'title_color',
698 [
699 'label' => __('Color', 'ultimate-store-kit'),
700 'type' => Controls_Manager::COLOR,
701 'selectors' => [
702 '{{WRAPPER}} .usk-featured-box .usk-title a' => 'color: {{VALUE}} ',
703 ],
704 ]
705 );
706
707 $this->add_control(
708 'title_hover_color',
709 [
710 'label' => __('Hover Color', 'ultimate-store-kit'),
711 'type' => Controls_Manager::COLOR,
712 'selectors' => [
713 '{{WRAPPER}} .usk-featured-box .usk-title a:hover' => 'color: {{VALUE}} ',
714 ],
715 ]
716 );
717
718 $this->add_responsive_control(
719 'title_margin',
720 [
721 'label' => esc_html__('Margin', 'ultimate-store-kit'),
722 'type' => Controls_Manager::DIMENSIONS,
723 'size_units' => ['px', 'em', '%'],
724 'selectors' => [
725 '{{WRAPPER}} .usk-featured-box .usk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
726 ],
727 ]
728 );
729
730 $this->add_group_control(
731 Group_Control_Typography::get_type(),
732 [
733 'name' => 'title_typography',
734 'selector' => '{{WRAPPER}} .usk-featured-box .usk-title',
735 ]
736 );
737
738 $this->end_controls_section();
739
740 $this->start_controls_section(
741 'section_style_text',
742 [
743 'label' => __('Text', 'ultimate-store-kit'),
744 'tab' => Controls_Manager::TAB_STYLE,
745 'condition' => [
746 'show_text' => 'yes',
747 ],
748 ]
749 );
750
751 $this->add_control(
752 'text_color',
753 [
754 'label' => __('Color', 'ultimate-store-kit'),
755 'type' => Controls_Manager::COLOR,
756 'selectors' => [
757 '{{WRAPPER}} .usk-featured-box .usk-text' => 'color: {{VALUE}};',
758 ],
759 ]
760 );
761
762 $this->add_responsive_control(
763 'text_margin',
764 [
765 'label' => esc_html__('Margin', 'ultimate-store-kit'),
766 'type' => Controls_Manager::DIMENSIONS,
767 'size_units' => ['px', 'em', '%'],
768 'selectors' => [
769 '{{WRAPPER}} .usk-featured-box .usk-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
770 ],
771 ]
772 );
773
774 $this->add_group_control(
775 Group_Control_Typography::get_type(),
776 [
777 'name' => 'text_typography',
778 'selector' => '{{WRAPPER}} .usk-featured-box .usk-text',
779 ]
780 );
781
782 $this->end_controls_section();
783
784 $this->start_controls_section(
785 'section_style_meta',
786 [
787 'label' => __('Meta', 'ultimate-store-kit'),
788 'tab' => Controls_Manager::TAB_STYLE,
789 'condition' => [
790 'show_meta' => 'yes',
791 ],
792 ]
793 );
794
795 $this->add_control(
796 'meta_color',
797 [
798 'label' => __('Color', 'ultimate-store-kit'),
799 'type' => Controls_Manager::COLOR,
800 'selectors' => [
801 '{{WRAPPER}} .usk-featured-box .usk-meta' => 'color: {{VALUE}};',
802 ],
803 ]
804 );
805
806 $this->add_control(
807 'meta_color_hover',
808 [
809 'label' => __('Hover Color', 'ultimate-store-kit'),
810 'type' => Controls_Manager::COLOR,
811 'selectors' => [
812 '{{WRAPPER}} .usk-featured-box .usk-meta:hover' => 'color: {{VALUE}};',
813 ],
814 ]
815 );
816
817 $this->add_responsive_control(
818 'meta_margin',
819 [
820 'label' => esc_html__('Margin', 'ultimate-store-kit'),
821 'type' => Controls_Manager::DIMENSIONS,
822 'size_units' => ['px', 'em', '%'],
823 'selectors' => [
824 '{{WRAPPER}} .usk-featured-box .usk-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
825 ],
826 ]
827 );
828
829 $this->add_group_control(
830 Group_Control_Typography::get_type(),
831 [
832 'name' => 'meta_typography',
833 'selector' => '{{WRAPPER}} .usk-featured-box .usk-meta',
834 ]
835 );
836
837 $this->end_controls_section();
838
839 $this->start_controls_section(
840 'section_style_readmore',
841 [
842 'label' => esc_html__('Button', 'ultimate-store-kit'),
843 'tab' => Controls_Manager::TAB_STYLE,
844 'condition' => [
845 'show_readmore' => 'yes',
846 ],
847 ]
848 );
849
850 $this->start_controls_tabs('tabs_readmore_style');
851
852 $this->start_controls_tab(
853 'tab_readmore_normal',
854 [
855 'label' => esc_html__('Normal', 'ultimate-store-kit'),
856 ]
857 );
858
859 $this->add_control(
860 'readmore_color',
861 [
862 'label' => esc_html__('Color', 'ultimate-store-kit'),
863 'type' => Controls_Manager::COLOR,
864 'selectors' => [
865 '{{WRAPPER}} .usk-featured-box .usk-link-btn a' => 'color: {{VALUE}};',
866 ],
867 ]
868 );
869
870 $this->add_group_control(
871 Group_Control_Background::get_type(),
872 [
873 'name' => 'readmore_background',
874 'selector' => '{{WRAPPER}} .usk-featured-box .usk-link-btn a',
875 ]
876 );
877
878 $this->add_group_control(
879 Group_Control_Border::get_type(),
880 [
881 'name' => 'readmore_border',
882 'label' => esc_html__('Border', 'ultimate-store-kit'),
883 'fields_options' => [
884 'border' => [
885 'default' => 'solid',
886 ],
887 'width' => [
888 'default' => [
889 'top' => '1',
890 'right' => '1',
891 'bottom' => '1',
892 'left' => '1',
893 'isLinked' => false,
894 ],
895 ],
896 'color' => [
897 'default' => '#D90429',
898 ],
899 ],
900 'selector' => '{{WRAPPER}} .usk-featured-box .usk-link-btn a',
901 'separator' => 'before',
902 ]
903 );
904
905 $this->add_responsive_control(
906 'readmore_radius',
907 [
908 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
909 'type' => Controls_Manager::DIMENSIONS,
910 'size_units' => ['px', '%'],
911 'selectors' => [
912 '{{WRAPPER}} .usk-featured-box .usk-link-btn a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
913 ],
914 ]
915 );
916
917 $this->add_responsive_control(
918 'readmore_padding',
919 [
920 'label' => esc_html__('Padding', 'ultimate-store-kit'),
921 'type' => Controls_Manager::DIMENSIONS,
922 'size_units' => ['px', 'em', '%'],
923 'selectors' => [
924 '{{WRAPPER}} .usk-featured-box .usk-link-btn a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
925 ],
926 ]
927 );
928
929 $this->add_responsive_control(
930 'readmore_margin',
931 [
932 'label' => esc_html__('Margin', 'ultimate-store-kit'),
933 'type' => Controls_Manager::DIMENSIONS,
934 'size_units' => ['px', 'em', '%'],
935 'selectors' => [
936 '{{WRAPPER}} .usk-featured-box .usk-link-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
937 ],
938 ]
939 );
940
941 $this->add_group_control(
942 Group_Control_Typography::get_type(),
943 [
944 'name' => 'readmore_typography',
945 'selector' => '{{WRAPPER}} .usk-featured-box .usk-link-btn a',
946 ]
947 );
948
949 $this->add_group_control(
950 Group_Control_Box_Shadow::get_type(),
951 [
952 'name' => 'readmore_box_shadow',
953 'selector' => '{{WRAPPER}} .usk-featured-box .usk-link-btn a',
954 ]
955 );
956
957 $this->end_controls_tab();
958
959 $this->start_controls_tab(
960 'tab_readmore_hover',
961 [
962 'label' => esc_html__('Hover', 'ultimate-store-kit'),
963 ]
964 );
965
966 $this->add_control(
967 'readmore_hover_color',
968 [
969 'label' => esc_html__('Color', 'ultimate-store-kit'),
970 'type' => Controls_Manager::COLOR,
971 'selectors' => [
972 '{{WRAPPER}} .usk-featured-box .usk-link-btn a:hover' => 'color: {{VALUE}};',
973 '{{WRAPPER}} .usk-featured-box .usk-link-btn a span::before' => 'background-color: {{VALUE}};',
974 '{{WRAPPER}} .usk-featured-box .usk-link-btn a span::after' => 'border-top-color: {{VALUE}}; border-right-color: {{VALUE}};',
975 ],
976 ]
977 );
978
979 $this->add_group_control(
980 Group_Control_Background::get_type(),
981 [
982 'name' => 'readmore_hover_background',
983 'selector' => '{{WRAPPER}} .usk-featured-box .usk-link-btn a:before',
984 ]
985 );
986
987 $this->add_control(
988 'readmore_hover_border_color',
989 [
990 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
991 'type' => Controls_Manager::COLOR,
992 'condition' => [
993 'readmore_border_border!' => '',
994 ],
995 'selectors' => [
996 '{{WRAPPER}} .usk-featured-box .usk-link-btn a:hover' => 'border-color: {{VALUE}};',
997 ],
998 ]
999 );
1000
1001 $this->end_controls_tab();
1002
1003 $this->end_controls_tabs();
1004
1005 $this->end_controls_section();
1006 }
1007
1008 public function render_title() {
1009 $settings = $this->get_settings_for_display();
1010
1011 if (!$settings['show_title']) {
1012 return;
1013 }
1014
1015 $this->add_render_attribute(
1016 [
1017 'title-link' => [
1018 'href' => isset($settings['title_link']['url']) && !empty($settings['title_link']['url']) ? esc_url($settings['title_link']['url']) : 'javascript:void(0);',
1019 'target' => $settings['title_link']['is_external'] ? '_blank' : '_self',
1020 ],
1021 ],
1022 '',
1023 '',
1024 true
1025 );
1026
1027 if (!empty($settings['title'])) {
1028 printf('<%1$s class="usk-title"><a %2$s title="%3$s">%3$s</a></%1$s>', esc_attr($settings['title_tag']), wp_kses_post($this->get_render_attribute_string('title-link')), wp_kses_post($settings['title']));
1029 }
1030 }
1031
1032 public function render_text() {
1033 $settings = $this->get_settings_for_display();
1034
1035 if (!$settings['show_text']) {
1036 return;
1037 }
1038
1039 ?>
1040 <?php if ($settings['text']): ?>
1041 <div class="usk-text">
1042 <?php echo wp_kses_post($settings['text']); ?>
1043 </div>
1044 <?php endif;
1045 }
1046
1047 public function render_meta() {
1048 $settings = $this->get_settings_for_display();
1049
1050 if (!$settings['show_meta']) {
1051 return;
1052 }
1053
1054 ?>
1055 <?php if ($settings['meta']): ?>
1056 <div class="usk-meta">
1057 <?php echo wp_kses_post($settings['meta']); ?>
1058 </div>
1059 <?php endif;
1060 }
1061
1062 public function rendar_image() {
1063 $settings = $this->get_settings_for_display();
1064
1065 if (empty($settings['image']['url'])) {
1066 return;
1067 }
1068
1069 ?>
1070
1071 <div class="usk-image-wrap"></div>
1072
1073 <?php
1074 }
1075
1076 public function render_readmore() {
1077 $settings = $this->get_settings_for_display();
1078
1079 if (!$settings['show_readmore']) {
1080 return;
1081 }
1082
1083 $this->add_render_attribute(
1084 [
1085 'readmore-link' => [
1086 'href' => isset($settings['readmore_link']['url']) ? esc_url($settings['readmore_link']['url']) : '#',
1087 'target' => $settings['readmore_link']['is_external'] ? '_blank' : '_self',
1088 ],
1089 ],
1090 '',
1091 '',
1092 true
1093 );
1094
1095 ?>
1096 <?php if ((!empty($settings['readmore_link']['url'])) && ($settings['show_readmore'])): ?>
1097 <div class="usk-link-btn">
1098 <a <?php $this->print_render_attribute_string('readmore-link');?>>
1099 <span><?php echo esc_html($settings['readmore_text']); ?></span>
1100 </a>
1101 </div>
1102 <?php endif;?>
1103 <?php
1104 }
1105
1106 protected function render() {
1107 $settings = $this->get_settings_for_display();
1108
1109 $this->add_render_attribute('featured-box', 'class', 'usk-featured-box usk-fb-content-position-' . $settings['position']);
1110
1111 $this->add_render_attribute(
1112 [
1113 'link' => [
1114 'href' => isset($settings['wrapper_link']['url']) && !empty($settings['wrapper_link']['url']) ? esc_url($settings['wrapper_link']['url']) : 'javascript:void(0);',
1115 'target' => $settings['show_wrapper_link'] == 'yes' and $settings['wrapper_link']['is_external'] ? '_blank' : '_self',
1116 ],
1117 ],
1118 '',
1119 '',
1120 true
1121 );
1122
1123 ?>
1124 <div <?php $this->print_render_attribute_string('featured-box');?>>
1125
1126 <div class="usk-item">
1127 <?php $this->rendar_image();?>
1128 <div class="usk-content">
1129 <?php $this->render_meta();?>
1130 <?php $this->render_title();?>
1131 <?php $this->render_text();?>
1132 <?php $this->render_readmore();?>
1133 </div>
1134 </div>
1135 <?php
1136 if ($settings['show_wrapper_link'] == 'yes' and !empty($settings['wrapper_link']['url'])) {
1137 printf('<a %1$s class="usk-featured-box-wrapper-link"></a>', wp_kses_post($this->get_render_attribute_string('link')));
1138 }?>
1139
1140 </div>
1141 <?php
1142 }
1143 }
1144