PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 1.6.3
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v1.6.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 1.6.3, at modules/featured-box/widgets/featured-box.php

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