PluginProbe
WP Directory Kit / 1.2.8
WP Directory Kit v1.2.8
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / elementor-elements / classes / wdk-listing-similar-listings.php

wdk-listing-similar-listings.php in WP Directory Kit 1.2.8, at elementor-elements/classes/wdk-listing-similar-listings.php

1,543 lines 62.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Elementor\Widgets;
4
5 use Wdk\Elementor\Widgets\WdkElementorBase;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Typography;
10 use Elementor\Editor;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Core\Schemes;
14 use Elementor\Icons_Manager;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Box_Shadow;
18
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkListingSimilarListings extends WdkElementorBase {
26
27 public function __construct($data = array(), $args = null) {
28
29 \Elementor\Controls_Manager::add_tab(
30 'tab_conf',
31 esc_html__('Settings', 'wpdirectorykit')
32 );
33
34 \Elementor\Controls_Manager::add_tab(
35 'tab_layout',
36 esc_html__('Layout', 'wpdirectorykit')
37 );
38
39 \Elementor\Controls_Manager::add_tab(
40 'tab_content',
41 esc_html__('Main', 'wpdirectorykit')
42 );
43
44 if ($this->is_edit_mode_load()) {
45 $this->enqueue_styles_scripts();
46 }
47
48 parent::__construct($data, $args);
49 }
50
51 /**
52 * Retrieve the widget name.
53 *
54 * @since 1.1.0
55 *
56 * @access public
57 *
58 * @return string Widget name.
59 */
60 public function get_name() {
61 return 'wdk-listing-similar-listings';
62 }
63
64 /**
65 * Retrieve the list of categories the widget belongs to.
66 *
67 * Used to determine where to display the widget in the editor.
68 *
69 * Note that currently Elementor supports only one category.
70 * When multiple categories passed, Elementor uses the first one.
71 *
72 * @since 1.1.0
73 *
74 * @access public
75 *
76 * @return array Widget categories.
77 */
78 public function get_categories() {
79 return [ 'wdk-elementor-listing-preview' ];
80 }
81
82 /**
83 * Retrieve the widget title.
84 *
85 * @since 1.1.0
86 *
87 * @access public
88 *
89 * @return string Widget title.
90 */
91 public function get_title() {
92 return esc_html__('Wdk Listing Similar Listings', 'wpdirectorykit');
93 }
94
95 /**
96 * Retrieve the widget icon.
97 *
98 * @since 1.1.0
99 *
100 * @access public
101 *
102 * @return string Widget icon.
103 */
104 public function get_icon() {
105 return 'eicon-products';
106 }
107
108 /**
109 * Register the widget controls.
110 *
111 * Adds different input fields to allow the user to change and customize the widget settings.
112 *
113 * @since 1.1.0
114 *
115 * @access protected
116 */
117 protected function register_controls() {
118 $this->generate_controls_conf();
119 $this->generate_controls_layout();
120 $this->generate_controls_styles();
121 $this->generate_controls_content();
122
123 $this->insert_pro_message('tab_conf');
124 parent::register_controls();
125 }
126
127 /**
128 * Render the widget output on the frontend.
129 *
130 * Written in PHP and used to generate the final HTML.
131 *
132 * @since 1.1.0
133 *
134 * @access protected
135 */
136 protected function render() {
137 parent::render();
138 global $wdk_listing_id;
139
140 $this->data['id_element'] = $this->get_id();
141 $this->data['settings'] = $this->get_settings();
142
143 $this->data['listings_count'] = 0;
144 $this->data['results'] = array();
145 $this->data['pagination_output'] = '';
146
147 $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by','is_featured', 'address');
148 $external_columns = array('location_id', 'category_id', 'post_title');
149 $custom_parameters = array();
150
151 $this->data['custom_order'] = array();
152 if ($this->data['settings']['custom_order_list']) {
153 foreach ($this->data['settings']['custom_order_list'] as $item) {
154 if (empty($item['title']) || empty($item['key'])) {
155 continue;
156 }
157 $this->data['custom_order'][] = array('title'=>$item['title'],'key'=>$item['key']);
158 }
159 }
160
161 $controller = 'listing';
162 $offset = NULL;
163
164 if (isset($wdk_listing_id)) {
165 foreach($this->data['settings']['similar_by_fields'] as $similar_field) {
166
167 if(empty($similar_field['field'])) continue;
168
169 if ($similar_field['field_skip_if_empty'] == 'true' && empty(wdk_field_value(str_replace('field','',$similar_field['field']), $wdk_listing_id))) {
170 continue;
171 }
172
173 if($similar_field['field'] == 'is_featured') {
174 if (!empty(wdk_field_value(str_replace('field','',$similar_field['field']), $wdk_listing_id))) {
175 $custom_parameters[$similar_field['field']] = 'on';
176 } else {
177 $custom_parameters[$similar_field['field']] = 'off';
178 }
179 } else {
180 $custom_parameters[$similar_field['field']] = wdk_field_value(str_replace('field','',$similar_field['field']), $wdk_listing_id);
181 }
182 }
183 }
184
185 if(wmvc_show_data('featured_query', $this->data['settings']) == 'only_featured') {
186 $custom_parameters['is_featured'] = 'on';
187 }
188
189 if(wmvc_show_data('featured_query', $this->data['settings']) == 'only_unfeatured') {
190 $custom_parameters['is_featured'] = 'off';
191 }
192
193 $_GET['order_by'] = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'];
194
195 /* if detected custom field for order */
196 if(!empty($this->data['settings']['conf_order_by_custom'])) {
197 $_GET['order_by'] = $this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order'];
198 }
199
200 //wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, TRUE);
201
202 /* filter same listing */
203
204 if (isset($wdk_listing_id)) {
205 global $wpdb;
206 $this->WMVC->db->where($wpdb->prefix.'wdk_listings.post_id != '.$wdk_listing_id) ;
207 }
208
209 $this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['per_page'], $offset, array('is_activated' => 1,'is_approved'=>1));
210
211 if(!empty($this->data['results']) && $this->data['listings_count'] == 0)
212 $this->data['listings_count'] = wmvc_count($this->data['results']);
213
214 $this->data['settings']['content_button_icon'] = $this->generate_icon($this->data['settings']['content_button_icon']);
215
216 $this->data['is_edit_mode'] = false;
217 if(Plugin::$instance->editor->is_edit_mode())
218 $this->data['is_edit_mode'] = true;
219
220 if(isset($_GET['wmvc_view_type']) && $this->data['settings']['get_filters_enable'] == 'yes') {
221 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'grid')
222 $this->data['settings']['layout_type'] = 'grid';
223 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'list')
224 $this->data['settings']['layout_type'] = 'list';
225 }
226
227 echo $this->view('wdk-listing-similar-listings', $this->data);
228 }
229
230
231 private function generate_controls_conf() {
232 $this->start_controls_section(
233 'tab_conf_main_section',
234 [
235 'label' => esc_html__('Main', 'wpdirectorykit'),
236 'tab' => 'tab_conf',
237 ]
238 );
239
240 if(true){
241 $this->add_control(
242 'per_page',
243 [
244 'label' => __( 'Limit Results (Per page)', 'wpdirectorykit' ),
245 'type' => \Elementor\Controls_Manager::NUMBER,
246 'min' => 1,
247 'max' => 250,
248 'step' => 1,
249 'default' => 6,
250 ]
251 );
252
253 $this->add_control(
254 'conf_order_by',
255 [
256 'label' => __('Default Order By Column', 'wpdirectorykit'),
257 'type' => Controls_Manager::SELECT,
258 'label_block' => true,
259 'options' => [
260 'none' => __('None', 'wpdirectorykit'),
261 'post_id' => __('ID', 'wpdirectorykit'),
262 'post_title' => __('Title', 'wpdirectorykit'),
263 ],
264 'default' => 'post_id',
265 ]
266 );
267
268 $this->add_control(
269 'conf_order_by_custom',
270 [
271 'label' => __('Default Custom Order By (小olumn', 'wpdirectorykit'),
272 'description' => '<span style="word-break: break-all;">'.__( 'Example:', 'wpdirectorykit' ).
273 '<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'.
274 '<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'.
275 '<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'.
276 '<br> category_title - Category Title'.
277 '<br> location_title - Location Title'.
278 '</span>',
279 'type' => Controls_Manager::TEXT,
280 'label_block' => true,
281 'default' => 'post_id',
282 ]
283 );
284
285 $this->add_control(
286 'conf_order',
287 [
288 'label' => __('Default Listing Order', 'wpdirectorykit'),
289 'type' => Controls_Manager::SELECT,
290 'label_block' => true,
291 'options' => [
292 'asc' => __('Ascending', 'wpdirectorykit'),
293 'desc' => __('Descending', 'wpdirectorykit')
294 ],
295 'default' => 'desc',
296 ]
297 );
298
299 }
300
301 $this->add_control (
302 'disable_not_found_alert',
303 [
304 'label' => __( 'Disable not found listings alert', 'wpdirectorykit' ),
305 'type' => \Elementor\Controls_Manager::SWITCHER,
306 'label_on' => __( 'On', 'wpdirectorykit' ),
307 'label_off' => __( 'Off', 'wpdirectorykit' ),
308 'return_value' => 'yes',
309 'default' => '',
310 ]
311 );
312
313 $this->add_control(
314 'featured_query',
315 [
316 'label' => __( 'Featured Listings', 'wpdirectorykit' ),
317 'type' => \Elementor\Controls_Manager::SELECT,
318 'default' => 'any',
319 'options' => [
320 'any' => __( 'Show Featured and Not Featured', 'wpdirectorykit' ),
321 'only_featured' => __( 'Show Only Featured', 'wpdirectorykit' ),
322 'only_unfeatured' => __( 'Show Only Not Featured', 'wpdirectorykit' ),
323 ],
324 ]
325 );
326
327 $WMVC = &wdk_get_instance();
328 $WMVC->model('field_m');
329 $fields_data = $WMVC->field_m->get_fields_data();
330 $fields_list = array('0' => esc_html__('Not Selected', 'wpdirectorykit'));
331 $fields_list ['category_id'] = esc_html__('Category', 'wpdirectorykit');
332 $fields_list ['location_id'] = esc_html__('Location', 'wpdirectorykit');
333 $fields_list ['is_featured'] = esc_html__('Featured', 'wpdirectorykit');
334
335 foreach($fields_data as $field)
336 {
337 $fields_list['field_'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
338 }
339
340 $repeater_similar_by_fields = new Repeater();
341 $repeater_similar_by_fields->start_controls_tabs( 'repeater_similar_by_fields' );
342
343 $repeater_similar_by_fields->add_control(
344 'field',
345 [
346 'label' => __( 'Field', 'wpdirectorykit' ),
347 'type' => \Elementor\Controls_Manager::SELECT,
348 'options' => $fields_list,
349 ]
350 );
351
352 $repeater_similar_by_fields->add_control (
353 'field_skip_if_empty',
354 [
355 'label' => __( 'Skip from query if empty value', 'wpdirectorykit' ),
356 'type' => \Elementor\Controls_Manager::SWITCHER,
357 'label_on' => __( 'On', 'wpdirectorykit' ),
358 'label_off' => __( 'Off', 'wpdirectorykit' ),
359 'return_value' => 'true',
360 'default' => '',
361 ]
362 );
363
364 $repeater_similar_by_fields->end_controls_tabs();
365
366 $this->add_control(
367 'similar_by_fields',
368 [
369 'label' => esc_html__('Fields For Query Similar Listings', 'wpdirectorykit'),
370 'type' => Controls_Manager::REPEATER,
371 'fields' => $repeater_similar_by_fields->get_controls(),
372 'default' => [
373 [
374 'field' => 'category_id',
375 ],
376 ],
377 'title_field' => '{{{ field }}}',
378 ]
379 );
380
381 $this->add_control(
382 'important_note',
383 [
384 'label' => '',
385 'type' => \Elementor\Controls_Manager::RAW_HTML,
386 'raw' => wdk_sprintf(__( 'Edit Result Card Designer <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_resultitem')),
387 'content_classes' => 'wdk_elementor_hint',
388 ]
389 );
390
391 $this->end_controls_section();
392
393 $this->start_controls_section(
394 'tab_conf_main_section_order',
395 [
396 'label' => esc_html__('Custom Order', 'wpdirectorykit'),
397 'tab' => 'tab_conf',
398 ]
399 );
400
401 $repeater_order = new Repeater();
402 $repeater_order->start_controls_tabs( 'orders' );
403 $repeater_order->add_control(
404 'key',
405 [
406 'label' => __( 'Order Key', 'wpdirectorykit' ),
407 'type' => \Elementor\Controls_Manager::TEXT,
408 'placeholder' => 'post_id ASC',
409 'description' => '<span style="word-break: break-all;">'.__( 'Custom Fields Order Example:', 'wpdirectorykit' ).
410 '<br> field_13_NUMBER ASC - where 13 is field id, NUMBER - field type'.
411 '<br> field_4_NUMBER DESC - where 4 is field id, NUMBER - field type'.
412 '<br> field_6_DROPDOWN ASC - where 6 is field id, DROPDOWN - field type'.
413 '<br> category_title - Category Title'.
414 '<br> location_title - Location Title'.
415 '</span>',
416 ]
417 );
418 $repeater_order->add_control(
419 'title',
420 [
421 'label' => __( 'Title', 'wpdirectorykit' ),
422 'type' => \Elementor\Controls_Manager::TEXT,
423 'placeholder' => __( 'Title', 'wpdirectorykit' ),
424 ]
425 );
426 $repeater_order->end_controls_tabs();
427
428 $this->add_control(
429 'custom_order_list',
430 [
431 'type' => Controls_Manager::REPEATER,
432 'fields' => $repeater_order->get_controls(),
433 'default' => [
434 ],
435 'title_field' => '{{{ title }}}',
436 ]
437 );
438
439 $this->end_controls_section();
440
441 }
442
443 private function generate_controls_layout() {
444 $this->start_controls_section(
445 'tab_content',
446 [
447 'label' => esc_html__('Basic', 'wpdirectorykit'),
448 'tab' => 'tab_layout',
449 ]
450 );
451
452 $this->add_control(
453 'layout_type',
454 [
455 'label' => __( 'Layout Type', 'wpdirectorykit' ),
456 'type' => \Elementor\Controls_Manager::SELECT,
457 'default' => 'grid',
458 'options' => [
459 'grid' => __( 'Grid', 'wpdirectorykit' ),
460 'list' => __( 'List', 'wpdirectorykit' ),
461 'carousel' => __( 'Carousel', 'wpdirectorykit' ),
462 ],
463 ]
464 );
465
466 $this->add_responsive_control(
467 'row_gap_col',
468 [
469 'label' => __( 'Columns', 'wpdirectorykit' ),
470 'type' => Controls_Manager::SELECT,
471 'options' => [
472 '' => esc_html__('Default', 'wpdirectorykit'),
473 'auto' => esc_html__('Auto', 'wpdirectorykit'),
474 '100%' => '1',
475 '50%' => '2',
476 'calc(100% / 3)' => '3',
477 '25%' => '4',
478 '20%' => '5',
479 'auto_flexible' => 'auto flexible',
480 ],
481 'selectors_dictionary' => [
482 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
483 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
484 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
485 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
486 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
487 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
488 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
489 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
490 ],
491 'selectors' => [
492 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
493 ],
494 'default' => '',
495 'separator' => 'before',
496 'conditions' => [
497 'terms' => [
498 [
499 'name' => 'layout_type',
500 'operator' => '==',
501 'value' => 'grid',
502 ]
503 ],
504 ],
505 ]
506 );
507
508 $this->add_responsive_control(
509 'column_gap',
510 [
511 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
512 'type' => Controls_Manager::SLIDER,
513 'default' => [
514 'size' => 10,
515 ],
516 'range' => [
517 'px' => [
518 'min' => 0,
519 'max' => 60,
520 ],
521 ],
522 'selectors' => [
523 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
524 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
525 ],
526 'conditions' => [
527 'terms' => [
528 [
529 'name' => 'layout_type',
530 'operator' => '==',
531 'value' => 'grid',
532 ]
533 ],
534 ],
535 ]
536 );
537
538 $this->add_responsive_control(
539 'row_gap',
540 [
541 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
542 'type' => Controls_Manager::SLIDER,
543 'default' => [
544 'size' => 10,
545 ],
546 'range' => [
547 'px' => [
548 'min' => 0,
549 'max' => 60,
550 ],
551 ],
552 'selectors' => [
553 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
554 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
555 ],
556 'conditions' => [
557 'terms' => [
558 [
559 'name' => 'layout_type',
560 'operator' => '!=',
561 'value' => 'carousel',
562 ]
563 ],
564 ],
565 ]
566 );
567
568 $this->add_responsive_control(
569 'thumbnail_width',
570 [
571 'label' => esc_html__('Thumbnail width (For List Version)', 'wpdirectorykit'),
572 'type' => Controls_Manager::SLIDER,
573 'default' => [
574 'size' => 35,
575 'unit' => '%',
576 ],
577 'size_units' => [ 'px', '%' ],
578 'range' => [
579 'px' => [
580 'min' => 0,
581 'max' => 600,
582 ],
583 '%' => [
584 'min' => 0,
585 'max' => 100,
586 ],
587 ],
588 'selectors' => [
589 '{{WRAPPER}} .wdk-element .wdk-listing-card.list .wdk-thumbnail' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
590 ],
591 'conditions' => [
592 'terms' => [
593 [
594 'name' => 'layout_type',
595 'operator' => '==',
596 'value' => 'list',
597 ]
598 ],
599 ],
600 ]
601 );
602
603 /* Carousel Grid Config */
604 if(true) {
605 $this->add_responsive_control(
606 'carousel_column_gap_carousel',
607 [
608 'label' => esc_html__('Slider Gap', 'wpdirectorykit'),
609 'type' => Controls_Manager::SLIDER,
610 'range' => [
611 'px' => [
612 'min' => 0,
613 'max' => 60,
614 ],
615 ],
616 'selectors' => [
617 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini ' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
618 ],
619 'conditions' => [
620 'terms' => [
621 [
622 'name' => 'layout_type',
623 'operator' => '==',
624 'value' => 'carousel',
625 ]
626 ],
627 ],
628 ]
629 );
630
631 $this->add_responsive_control (
632 'carousel_column_gap',
633 [
634 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
635 'type' => Controls_Manager::SLIDER,
636 'default' => [
637 'size' => 10,
638 ],
639 'range' => [
640 'px' => [
641 'min' => 0,
642 'max' => 60,
643 ],
644 ],
645 'selectors' => [
646 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
647 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
648 ],
649 'conditions' => [
650 'terms' => [
651 [
652 'name' => 'layout_type',
653 'operator' => '==',
654 'value' => 'carousel',
655 ]
656 ],
657 ],
658 ]
659 );
660
661 $this->add_responsive_control(
662 'carousel_column_gap_top',
663 [
664 'label' => esc_html__('Columns Gap Top', 'wpdirectorykit'),
665 'type' => Controls_Manager::SLIDER,
666 'default' => [
667 'size' => 0,
668 ],
669 'range' => [
670 'px' => [
671 'min' => 0,
672 'max' => 60,
673 ],
674 ],
675 'selectors' => [
676 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-top: {{SIZE}}{{UNIT}};',
677 ],
678 'conditions' => [
679 'terms' => [
680 [
681 'name' => 'layout_type',
682 'operator' => '==',
683 'value' => 'carousel',
684 ]
685 ],
686 ],
687 ]
688 );
689
690 $this->add_responsive_control(
691 'carousel_column_gap_bottom',
692 [
693 'label' => esc_html__('Columns Gap Bottom', 'wpdirectorykit'),
694 'type' => Controls_Manager::SLIDER,
695 'default' => [
696 'size' => 10,
697 ],
698 'range' => [
699 'px' => [
700 'min' => 0,
701 'max' => 60,
702 ],
703 ],
704 'selectors' => [
705 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-bottom: {{SIZE}}{{UNIT}};',
706 ],
707 'conditions' => [
708 'terms' => [
709 [
710 'name' => 'layout_type',
711 'operator' => '==',
712 'value' => 'carousel',
713 ]
714 ],
715 ],
716 ]
717 );
718 }
719
720 $this->end_controls_section();
721
722 $this->start_controls_section(
723 'layout_carousel_sec',
724 [
725 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
726 'tab' => 'tab_layout',
727 'conditions' => [
728 'terms' => [
729 [
730 'name' => 'layout_type',
731 'operator' => '==',
732 'value' => 'carousel',
733 ]
734 ],
735 ],
736 ]
737 );
738
739 $this->add_control(
740 'layout_carousel_is_infinite',
741 [
742 'label' => __( 'Infinite', 'wpdirectorykit' ),
743 'type' => \Elementor\Controls_Manager::SWITCHER,
744 'label_on' => __( 'On', 'wpdirectorykit' ),
745 'label_off' => __( 'Off', 'wpdirectorykit' ),
746 'return_value' => 'true',
747 'default' => 'true',
748 ]
749 );
750
751 $this->add_control(
752 'layout_carousel_is_autoplay',
753 [
754 'label' => __( 'Autoplay', 'wpdirectorykit' ),
755 'type' => \Elementor\Controls_Manager::SWITCHER,
756 'label_on' => __( 'On', 'wpdirectorykit' ),
757 'label_off' => __( 'Off', 'wpdirectorykit' ),
758 'return_value' => 'true',
759 'default' => '',
760 ]
761 );
762
763 $this->add_control(
764 'layout_carousel_speed',
765 [
766 'label' => __( 'Speed', 'wpdirectorykit' ),
767 'type' => \Elementor\Controls_Manager::NUMBER,
768 'min' => 0,
769 'max' => 100000,
770 'step' => 100,
771 'default' => 500,
772 ]
773 );
774
775 $this->add_control(
776 'layout_carousel_animation_style',
777 [
778 'label' => __( 'Animation Style', 'wpdirectorykit' ),
779 'type' => \Elementor\Controls_Manager::SELECT,
780 'default' => 'fade',
781 'options' => [
782 'slide' => __( 'Slide', 'wpdirectorykit' ),
783 'fade' => __( 'Fade', 'wpdirectorykit' ),
784 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
785 ],
786 ]
787 );
788
789 $this->add_control(
790 'layout_carousel_cssease',
791 [
792 'label' => __( 'cssEase', 'wpdirectorykit' ),
793 'type' => \Elementor\Controls_Manager::SELECT,
794 'default' => 'linear',
795 'options' => [
796 'linear' => __( 'linear', 'wpdirectorykit' ),
797 'ease' => __( 'ease', 'wpdirectorykit' ),
798 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
799 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
800 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
801 'step-start' => __( 'step-start', 'wpdirectorykit' ),
802 'step-end' => __( 'step-end', 'wpdirectorykit' ),
803 ],
804 ]
805 );
806
807 $this->add_responsive_control(
808 'layout_carousel_columns',
809 [
810 'label' => __( 'Count grid', 'wpdirectorykit' ),
811 'type' => \Elementor\Controls_Manager::NUMBER,
812 'min' => 1,
813 'max' => 10,
814 'step' => 1,
815 'default' => 3,
816 ]
817 );
818
819 $this->end_controls_section();
820
821 }
822
823 private function generate_controls_styles() {
824 $this->start_controls_section(
825 'sstyles_thmbn_section',
826 [
827 'label' => esc_html__('Section Image', 'wpdirectorykit'),
828 'tab' => Controls_Manager::TAB_STYLE,
829 ]
830 );
831
832 $this->add_responsive_control(
833 'styles_thmbn_des_type',
834 [
835 'label' => __( 'Design type', 'wpdirectorykit' ),
836 'type' => \Elementor\Controls_Manager::SELECT,
837 'default' => 'wdk_size_image_cover',
838 'options' => [
839 'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ),
840 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
841 ],
842 ]
843 );
844
845 $this->add_responsive_control(
846 'styles_thmbn_des_height',
847 [
848 'label' => esc_html__('Height', 'wpdirectorykit'),
849 'type' => Controls_Manager::SLIDER,
850 'range' => [
851 'px' => [
852 'min' => 50,
853 'max' => 1500,
854 ],
855 'vw' => [
856 'min' => 0,
857 'max' => 100,
858 ]
859 ],
860 'size_units' => [ 'px', 'vw' ],
861 'default' => [
862 'size' => 220,
863 'unit' => 'px',
864 ],
865 'selectors' => [
866 '{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
867 ],
868 'separator' => 'after',
869 'conditions' => [
870 'relation' => 'or',
871 'terms' => [
872 [
873 'name' => 'styles_thmbn_des_type',
874 'operator' => '==',
875 'value' => 'wdk_size_image_cover',
876 ],
877 [
878 'name' => 'styles_thmbn_des_type',
879 'operator' => '==',
880 'value' => 'wdk_image_cover',
881 ]
882 ],
883 ]
884 ]
885 );
886 $this->end_controls_section();
887
888 $this->start_controls_section(
889 'styles_carousel_arrows_section',
890 [
891 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
892 'tab' => Controls_Manager::TAB_STYLE,
893 'conditions' => [
894 'terms' => [
895 [
896 'name' => 'layout_type',
897 'operator' => '==',
898 'value' => 'carousel',
899 ]
900 ],
901 ],
902 ]
903 );
904
905 $this->add_responsive_control(
906 'styles_carousel_arrows_hide',
907 [
908 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
909 'type' => Controls_Manager::SWITCHER,
910 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
911 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
912 'return_value' => 'none',
913 'default' => '',
914 'selectors' => [
915 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
916 ],
917 ]
918 );
919
920 $this->add_responsive_control(
921 'styles_carousel_arrows_position',
922 [
923 'label' => __( 'Position', 'wpdirectorykit' ),
924 'type' => \Elementor\Controls_Manager::SELECT,
925 'default' => 'wdk_slider_arrows_bottom',
926 'options' => [
927 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
928 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
929 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
930 ],
931 ]
932 );
933
934 if(false)
935 $this->add_responsive_control(
936 'styles_carousel_arrows_position_style',
937 [
938 'label' => __( 'Position Style', 'wpdirectorykit' ),
939 'type' => \Elementor\Controls_Manager::SELECT,
940 'default' => 'wdk_slider_arrows_out',
941 'options' => [
942 'wdk_slider_arrows_out' => __( 'Out', 'wpdirectorykit' ),
943 'wdk_slider_arrows_in' => __( 'In', 'wpdirectorykit' ),
944 ],
945 ]
946 );
947
948 $this->add_responsive_control(
949 'styles_carousel_arrows_align',
950 [
951 'label' => __( 'Align', 'wpdirectorykit' ),
952 'type' => Controls_Manager::CHOOSE,
953 'options' => [
954 'left' => [
955 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
956 'icon' => 'eicon-text-align-left',
957 ],
958 'center' => [
959 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
960 'icon' => 'eicon-text-align-center',
961 ],
962 'right' => [
963 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
964 'icon' => 'eicon-text-align-right',
965 ],
966 'justify' => [
967 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
968 'icon' => 'eicon-text-align-justify',
969 ],
970 ],
971 'render_type' => 'ui',
972 'selectors_dictionary' => [
973 'left' => 'justify-content: flex-start;',
974 'center' => 'justify-content: center;',
975 'right' => 'justify-content: flex-end;',
976 'justify' => 'justify-content: space-between;',
977 ],
978 'selectors' => [
979 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};',
980 ],
981 'conditions' => [
982 'terms' => [
983 [
984 'name' => 'styles_carousel_arrows_position',
985 'operator' => '!=',
986 'value' => 'wdk_slider_arrows_middle',
987 ]
988 ],
989 ],
990 ]
991 );
992
993 $this->add_responsive_control(
994 'styles_carousel_arrows_icon_left_h',
995 [
996 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
997 'type' => Controls_Manager::HEADING,
998 'separator' => 'before',
999 ]
1000 );
1001
1002 $this->add_responsive_control(
1003 'styles_carousel_arrows_s_m_left_margin',
1004 [
1005 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
1006 'type' => Controls_Manager::DIMENSIONS,
1007 'size_units' => [ 'px', 'em', '%' ],
1008 'allowed_dimensions' => 'horizontal',
1009 'selectors' => [
1010 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
1011 ],
1012 ]
1013 );
1014
1015 $this->add_responsive_control(
1016 'styles_carousel_arrows_icon_left',
1017 [
1018 'label' => esc_html__('Icon', 'wpdirectorykit'),
1019 'type' => Controls_Manager::ICONS,
1020 'label_block' => true,
1021 'default' => [
1022 'value' => 'fa fa-angle-left',
1023 'library' => 'solid',
1024 ],
1025 ]
1026 );
1027
1028 $this->add_responsive_control(
1029 'styles_carousel_arrows_icon_right_h',
1030 [
1031 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
1032 'type' => Controls_Manager::HEADING,
1033 'separator' => 'before',
1034 ]
1035 );
1036
1037 $this->add_responsive_control(
1038 'styles_carousel_arrows_s_m_right_margin',
1039 [
1040 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
1041 'type' => Controls_Manager::DIMENSIONS,
1042 'size_units' => [ 'px', 'em', '%' ],
1043 'allowed_dimensions' => 'horizontal',
1044 'selectors' => [
1045 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
1046 ],
1047 ]
1048 );
1049
1050 $this->add_responsive_control(
1051 'styles_carousel_arrows_icon_right',
1052 [
1053 'label' => esc_html__('Icon', 'wpdirectorykit'),
1054 'type' => Controls_Manager::ICONS,
1055 'label_block' => true,
1056 'default' => [
1057 'value' => 'fa fa-angle-right',
1058 'library' => 'solid',
1059 ],
1060 ]
1061 );
1062
1063 $selectors = array(
1064 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
1065 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
1066 );
1067 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['typo','color','background','border','border_radius','padding','shadow','transition']);
1068
1069 $this->end_controls_section();
1070
1071 $this->start_controls_section(
1072 'styles_carousel_dots_section',
1073 [
1074 'label' => esc_html__('Section Dots', 'wpdirectorykit'),
1075 'tab' => Controls_Manager::TAB_STYLE,
1076 'conditions' => [
1077 'terms' => [
1078 [
1079 'name' => 'layout_type',
1080 'operator' => '==',
1081 'value' => 'carousel',
1082 ]
1083 ],
1084 ],
1085 ]
1086 );
1087
1088 $this->add_responsive_control(
1089 'styles_carousel_dots_hide',
1090 [
1091 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1092 'type' => Controls_Manager::SWITCHER,
1093 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1094 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1095 'return_value' => 'none',
1096 'default' => '',
1097 'selectors' => [
1098 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
1099 ],
1100 ]
1101 );
1102
1103 $this->add_responsive_control(
1104 'styles_carousel_dots_position_style',
1105 [
1106 'label' => __( 'Position Style', 'wpdirectorykit' ),
1107 'type' => \Elementor\Controls_Manager::SELECT,
1108 'default' => 'wdk_slider_dots_out',
1109 'options' => [
1110 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
1111 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
1112 ],
1113 ]
1114 );
1115
1116 $this->add_responsive_control(
1117 'styles_carousel_dots_align',
1118 [
1119 'label' => __( 'Position', 'wpdirectorykit' ),
1120 'type' => Controls_Manager::CHOOSE,
1121 'options' => [
1122 'left' => [
1123 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1124 'icon' => 'eicon-text-align-left',
1125 ],
1126 'center' => [
1127 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1128 'icon' => 'eicon-text-align-center',
1129 ],
1130 'right' => [
1131 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1132 'icon' => 'eicon-text-align-right',
1133 ],
1134 'justify' => [
1135 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1136 'icon' => 'eicon-text-align-justify',
1137 ],
1138 ],
1139 'render_type' => 'ui',
1140 'selectors_dictionary' => [
1141 'left' => 'justify-content: flex-start;',
1142 'center' => 'justify-content: center;',
1143 'right' => 'justify-content: flex-end;',
1144 'justify' => 'justify-content: space-between;',
1145 ],
1146 'selectors' => [
1147 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};',
1148 ],
1149 ]
1150 );
1151
1152 $this->add_responsive_control(
1153 'styles_carousel_dots_icon',
1154 [
1155 'label' => esc_html__('Icon', 'wpdirectorykit'),
1156 'type' => Controls_Manager::ICONS,
1157 'label_block' => true,
1158 'default' => [
1159 'value' => 'fas fa-circle',
1160 'library' => 'solid',
1161 ],
1162 ]
1163 );
1164
1165 $selectors = array(
1166 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot',
1167 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s'
1168 );
1169 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
1170
1171 $this->end_controls_section();
1172 }
1173
1174 private function generate_controls_content() {
1175 $this->start_controls_section(
1176 'content_thumbnail_section',
1177 [
1178 'label' => esc_html__('Colors', 'wpdirectorykit'),
1179 'tab' => '1',
1180 ]
1181 );
1182
1183 $this->add_control(
1184 'content_thumbnail_section_header',
1185 [
1186 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
1187 'type' => Controls_Manager::HEADING,
1188 ]
1189 );
1190
1191 $this->add_responsive_control(
1192 'content_thumbnail_section_d_background',
1193 [
1194 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
1195 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
1196 'type' => Controls_Manager::COLOR,
1197 'selectors' => [
1198 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
1199 ],
1200 ]
1201 );
1202
1203 $this->add_control(
1204 'content_thumbnail_section_header_f',
1205 [
1206 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
1207 'type' => Controls_Manager::HEADING,
1208 ]
1209 );
1210
1211 $this->add_group_control(
1212 Group_Control_Box_Shadow::get_type(),
1213 [
1214 'name' => 'content_thumbnail_section_d_featured',
1215 'exclude' => [
1216 'field_shadow_position',
1217 ],
1218 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
1219 ]
1220 );
1221
1222 $this->end_controls_section();
1223 $items = [
1224 [
1225 'key'=>'content_card',
1226 'label'=> esc_html__('Card', 'wpdirectorykit'),
1227 'selector'=>'.wdk-element .wdk-listing-card',
1228 'options'=>'full',
1229 ],
1230 [
1231 'key'=>'content_label',
1232 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
1233 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
1234 'options'=>'full',
1235 ],
1236 [
1237 'key'=>'content_type',
1238 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
1239 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
1240 'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
1241 'options'=>'full',
1242 ],
1243 [
1244 'key'=>'content_title',
1245 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
1246 'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title',
1247 'options'=>'full',
1248 ],
1249 [
1250 'key'=>'content_description',
1251 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
1252 'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part',
1253 'options'=>'full',
1254 ],
1255 [
1256 'key'=>'content_items',
1257 'label'=> esc_html__('Features part', 'wpdirectorykit'),
1258 'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span',
1259 'options'=>'full',
1260 ],
1261 [
1262 'key'=>'wdk-divider',
1263 'label'=> esc_html__('Divider', 'wpdirectorykit'),
1264 'selector'=>'.wdk-element .wdk-listing-card .wdk-divider',
1265 'options'=>'full',
1266 ],
1267 [
1268 'key'=>'content_price',
1269 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
1270 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price',
1271 'options'=>'full',
1272 ],
1273 [
1274 'key'=>'content_button',
1275 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
1276 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn',
1277 'options'=>'full',
1278 ],
1279 ];
1280
1281 foreach ($items as $item) {
1282 $this->start_controls_section(
1283 $item['key'].'_section',
1284 [
1285 'label' => $item['label'],
1286 'tab' => '1',
1287 ]
1288 );
1289 $this->add_responsive_control(
1290 $item['key'].'_hide',
1291 [
1292 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1293 'type' => Controls_Manager::SWITCHER,
1294 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1295 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1296 'return_value' => 'none',
1297 'default' => '',
1298 'selectors' => [
1299 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
1300 ],
1301 ]
1302 );
1303 $selectors = array(
1304 'normal' => '{{WRAPPER}} '.$item['selector'],
1305 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
1306 );
1307
1308 if(isset($item['is_featured'])) {
1309 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
1310 }
1311
1312 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
1313
1314 /* special for some elements */
1315 if ($item['key'] == 'content_description') {
1316
1317 $this->add_control(
1318 'content_description_limit',
1319 [
1320 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
1321 'type' => \Elementor\Controls_Manager::NUMBER,
1322 'min' => 1,
1323 'max' => 10,
1324 'step' => 1,
1325 'default' => 3,
1326 'selectors' => [
1327 '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};',
1328 ],
1329 ]
1330 );
1331
1332 }
1333 if($item['key'] == 'content_button') {
1334 $this->add_control(
1335 $item['key'].'_icon',
1336 [
1337 'label' => esc_html__('Icon', 'wpdirectorykit'),
1338 'type' => Controls_Manager::ICONS,
1339 'label_block' => true,
1340 'default' => [
1341 'value' => 'fa fa-angle-right',
1342 'library' => 'solid',
1343 ],
1344 ]
1345 );
1346 $this->add_responsive_control(
1347 $item['key'].'_text',
1348 [
1349 'label' => __( 'Text of Link', 'wpdirectorykit' ),
1350 'type' => \Elementor\Controls_Manager::TEXT,
1351 'default' => '',
1352 ]
1353 );
1354
1355 $selectors = array(
1356 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
1357 );
1358 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
1359 }
1360
1361 if($item['key'] == 'content_label') {
1362 $this->add_control(
1363 $item['key'].'_parent_head',
1364 [
1365 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1366 'type' => Controls_Manager::HEADING,
1367 'separator' => 'before',
1368 ]
1369 );
1370
1371 $selectors = array(
1372 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-over-image-top',
1373 );
1374 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']);
1375 }
1376
1377 if($item['key'] == 'content_items') {
1378 $this->add_control(
1379 $item['key'].'_parent_head',
1380 [
1381 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1382 'type' => Controls_Manager::HEADING,
1383 'separator' => 'before',
1384 ]
1385 );
1386
1387 $selectors = array(
1388 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part',
1389 );
1390 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
1391 }
1392
1393 if($item['key'] == 'content_label') {
1394 $this->add_responsive_control(
1395 $item['key'] .'content_label_positions_y',
1396 [
1397 'label' => __( 'Position Y', 'wpdirectorykit' ),
1398 'type' => Controls_Manager::CHOOSE,
1399 'options' => [
1400 'top' => [
1401 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1402 'icon' => 'eicon-text-align-top',
1403 ],
1404 'center' => [
1405 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1406 'icon' => 'eicon-text-align-center',
1407 ],
1408 'bottom' => [
1409 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1410 'icon' => 'eicon-text-align-bottom',
1411 ],
1412 ],
1413 'default' => 'left',
1414 'render_type' => 'ui',
1415 'selectors_dictionary' => [
1416 'top' => 'top:0;bottom:initial',
1417 'center' => 'top:50%;transform: translateY(-50%)',
1418 'bottom' => 'top:initial;bottom:0',
1419 ],
1420 'selectors' => [
1421 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1422 ],
1423 ]
1424 );
1425
1426 $this->add_responsive_control(
1427 $item['key'] .'content_label_positions_x',
1428 [
1429 'label' => __( 'Position X', 'wpdirectorykit' ),
1430 'type' => Controls_Manager::CHOOSE,
1431 'options' => [
1432 'left' => [
1433 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1434 'icon' => 'eicon-text-align-left',
1435 ],
1436 'center' => [
1437 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1438 'icon' => 'eicon-text-align-center',
1439 ],
1440 'right' => [
1441 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1442 'icon' => 'eicon-text-align-right',
1443 ],
1444 ],
1445 'default' => 'left',
1446 'render_type' => 'ui',
1447 'selectors_dictionary' => [
1448 'left' => 'left:0',
1449 'center' => 'left:50%;transform: translateX(-50%)',
1450 'right' => 'left:initial; right:0',
1451 ],
1452 'selectors' => [
1453 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1454 ],
1455 ]
1456 );
1457 }
1458
1459 if($item['key'] == 'content_type') {
1460 $this->add_responsive_control(
1461 $item['key'] .'content_label_positions_y',
1462 [
1463 'label' => __( 'Position Y', 'wpdirectorykit' ),
1464 'type' => Controls_Manager::CHOOSE,
1465 'options' => [
1466 'top' => [
1467 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1468 'icon' => 'eicon-text-align-top',
1469 ],
1470 'center' => [
1471 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1472 'icon' => 'eicon-text-align-center',
1473 ],
1474 'bottom' => [
1475 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1476 'icon' => 'eicon-text-align-bottom',
1477 ],
1478 ],
1479 'default' => 'left',
1480 'render_type' => 'ui',
1481 'selectors_dictionary' => [
1482 'top' => 'top:0;bottom:initial',
1483 'center' => 'top:50%;transform: translateY(-50%)',
1484 'bottom' => 'top:initial;bottom:0',
1485 ],
1486 'selectors' => [
1487 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1488 ],
1489 ]
1490 );
1491
1492 $this->add_responsive_control(
1493 $item['key'] .'content_label_positions_x',
1494 [
1495 'label' => __( 'Position X', 'wpdirectorykit' ),
1496 'type' => Controls_Manager::CHOOSE,
1497 'options' => [
1498 'left' => [
1499 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1500 'icon' => 'eicon-text-align-left',
1501 ],
1502 'center' => [
1503 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1504 'icon' => 'eicon-text-align-center',
1505 ],
1506 'right' => [
1507 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1508 'icon' => 'eicon-text-align-right',
1509 ],
1510 'justify' => [
1511 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1512 'icon' => 'eicon-text-align-justify',
1513 ],
1514 ],
1515 'default' => 'left',
1516 'render_type' => 'ui',
1517 'selectors_dictionary' => [
1518 'top' => 'justify-content: flex-start;',
1519 'center' => 'justify-content: center;',
1520 'bottom' => 'justify-content: flex-end;',
1521 'justify' => 'justify-content: stretch;',
1522 ],
1523 'selectors' => [
1524 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1525 ],
1526 ]
1527 );
1528 }
1529 $this->end_controls_section();
1530 }
1531
1532 }
1533
1534 public function enqueue_styles_scripts() {
1535 wp_enqueue_style('slick');
1536 wp_enqueue_style('slick-theme');
1537 wp_enqueue_script('slick');
1538
1539 wp_enqueue_style('wdk-notify');
1540 wp_enqueue_script('wdk-notify');
1541 }
1542 }
1543