PluginProbe
WP Directory Kit / 1.3.3
WP Directory Kit v1.3.3
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 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-listing-similar-listings.php

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

1,553 lines 62.7 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 Sort 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 Sort 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::SELECT2,
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 Sort', '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' => __( 'Sort 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->add_control(
721 'basic_el_header_1',
722 [
723 'label' => esc_html__('Text', 'wpdirectorykit'),
724 'type' => Controls_Manager::HEADING,
725 'separator' => 'before',
726 ]
727 );
728
729 $this->add_control(
730 'content_button_text',
731 [
732 'label' => __( 'Button Open Text', 'wpdirectorykit' ),
733 'type' => \Elementor\Controls_Manager::TEXT,
734 'default' => '',
735 ]
736 );
737
738 $this->end_controls_section();
739
740 $this->start_controls_section(
741 'layout_carousel_sec',
742 [
743 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
744 'tab' => 'tab_layout',
745 'conditions' => [
746 'terms' => [
747 [
748 'name' => 'layout_type',
749 'operator' => '==',
750 'value' => 'carousel',
751 ]
752 ],
753 ],
754 ]
755 );
756
757 $this->add_control(
758 'layout_carousel_is_infinite',
759 [
760 'label' => __( 'Infinite', 'wpdirectorykit' ),
761 'type' => \Elementor\Controls_Manager::SWITCHER,
762 'label_on' => __( 'On', 'wpdirectorykit' ),
763 'label_off' => __( 'Off', 'wpdirectorykit' ),
764 'return_value' => 'true',
765 'default' => 'true',
766 ]
767 );
768
769 $this->add_control(
770 'layout_carousel_is_autoplay',
771 [
772 'label' => __( 'Autoplay', 'wpdirectorykit' ),
773 'type' => \Elementor\Controls_Manager::SWITCHER,
774 'label_on' => __( 'On', 'wpdirectorykit' ),
775 'label_off' => __( 'Off', 'wpdirectorykit' ),
776 'return_value' => 'true',
777 'default' => '',
778 ]
779 );
780
781 $this->add_control(
782 'layout_carousel_speed',
783 [
784 'label' => __( 'Speed', 'wpdirectorykit' ),
785 'type' => \Elementor\Controls_Manager::NUMBER,
786 'min' => 0,
787 'max' => 100000,
788 'step' => 100,
789 'default' => 500,
790 ]
791 );
792
793 $this->add_control(
794 'layout_carousel_animation_style',
795 [
796 'label' => __( 'Animation Style', 'wpdirectorykit' ),
797 'type' => \Elementor\Controls_Manager::SELECT,
798 'default' => 'fade',
799 'options' => [
800 'slide' => __( 'Slide', 'wpdirectorykit' ),
801 'fade' => __( 'Fade', 'wpdirectorykit' ),
802 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
803 ],
804 ]
805 );
806
807 $this->add_control(
808 'layout_carousel_cssease',
809 [
810 'label' => __( 'cssEase', 'wpdirectorykit' ),
811 'type' => \Elementor\Controls_Manager::SELECT,
812 'default' => 'linear',
813 'options' => [
814 'linear' => __( 'linear', 'wpdirectorykit' ),
815 'ease' => __( 'ease', 'wpdirectorykit' ),
816 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
817 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
818 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
819 'step-start' => __( 'step-start', 'wpdirectorykit' ),
820 'step-end' => __( 'step-end', 'wpdirectorykit' ),
821 ],
822 ]
823 );
824
825 $this->add_responsive_control(
826 'layout_carousel_columns',
827 [
828 'label' => __( 'Count grid', 'wpdirectorykit' ),
829 'type' => \Elementor\Controls_Manager::NUMBER,
830 'min' => 1,
831 'max' => 10,
832 'step' => 1,
833 'default' => 3,
834 ]
835 );
836
837 $this->end_controls_section();
838
839 }
840
841 private function generate_controls_styles() {
842 $this->start_controls_section(
843 'sstyles_thmbn_section',
844 [
845 'label' => esc_html__('Section Image', 'wpdirectorykit'),
846 'tab' => Controls_Manager::TAB_STYLE,
847 ]
848 );
849
850 $this->add_responsive_control(
851 'styles_thmbn_des_type',
852 [
853 'label' => __( 'Design type', 'wpdirectorykit' ),
854 'type' => \Elementor\Controls_Manager::SELECT,
855 'default' => 'wdk_size_image_cover',
856 'options' => [
857 'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ),
858 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
859 ],
860 ]
861 );
862
863 $this->add_responsive_control(
864 'styles_thmbn_des_height',
865 [
866 'label' => esc_html__('Height', 'wpdirectorykit'),
867 'type' => Controls_Manager::SLIDER,
868 'range' => [
869 'px' => [
870 'min' => 50,
871 'max' => 1500,
872 ],
873 'vw' => [
874 'min' => 0,
875 'max' => 100,
876 ]
877 ],
878 'size_units' => [ 'px', 'vw' ],
879 'default' => [
880 'size' => 220,
881 'unit' => 'px',
882 ],
883 'selectors' => [
884 '{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
885 ],
886 'separator' => 'after',
887 'conditions' => [
888 'relation' => 'or',
889 'terms' => [
890 [
891 'name' => 'styles_thmbn_des_type',
892 'operator' => '==',
893 'value' => 'wdk_size_image_cover',
894 ],
895 [
896 'name' => 'styles_thmbn_des_type',
897 'operator' => '==',
898 'value' => 'wdk_image_cover',
899 ]
900 ],
901 ]
902 ]
903 );
904 $this->end_controls_section();
905
906 $this->start_controls_section(
907 'styles_carousel_arrows_section',
908 [
909 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
910 'tab' => Controls_Manager::TAB_STYLE,
911 'conditions' => [
912 'terms' => [
913 [
914 'name' => 'layout_type',
915 'operator' => '==',
916 'value' => 'carousel',
917 ]
918 ],
919 ],
920 ]
921 );
922
923 $this->add_responsive_control(
924 'styles_carousel_arrows_hide',
925 [
926 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
927 'type' => Controls_Manager::SWITCHER,
928 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
929 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
930 'return_value' => 'none',
931 'default' => '',
932 'selectors' => [
933 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
934 ],
935 ]
936 );
937
938 $this->add_responsive_control(
939 'styles_carousel_arrows_position',
940 [
941 'label' => __( 'Position', 'wpdirectorykit' ),
942 'type' => \Elementor\Controls_Manager::SELECT,
943 'default' => 'wdk_slider_arrows_bottom',
944 'options' => [
945 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
946 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
947 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
948 ],
949 ]
950 );
951
952 if(false)
953 $this->add_responsive_control(
954 'styles_carousel_arrows_position_style',
955 [
956 'label' => __( 'Position Style', 'wpdirectorykit' ),
957 'type' => \Elementor\Controls_Manager::SELECT,
958 'default' => 'wdk_slider_arrows_out',
959 'options' => [
960 'wdk_slider_arrows_out' => __( 'Out', 'wpdirectorykit' ),
961 'wdk_slider_arrows_in' => __( 'In', 'wpdirectorykit' ),
962 ],
963 ]
964 );
965
966 $this->add_responsive_control(
967 'styles_carousel_arrows_align',
968 [
969 'label' => __( 'Align', 'wpdirectorykit' ),
970 'type' => Controls_Manager::CHOOSE,
971 'options' => [
972 'left' => [
973 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
974 'icon' => 'eicon-text-align-left',
975 ],
976 'center' => [
977 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
978 'icon' => 'eicon-text-align-center',
979 ],
980 'right' => [
981 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
982 'icon' => 'eicon-text-align-right',
983 ],
984 'justify' => [
985 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
986 'icon' => 'eicon-text-align-justify',
987 ],
988 ],
989 'render_type' => 'ui',
990 'selectors_dictionary' => [
991 'left' => 'justify-content: flex-start;',
992 'center' => 'justify-content: center;',
993 'right' => 'justify-content: flex-end;',
994 'justify' => 'justify-content: space-between;',
995 ],
996 'selectors' => [
997 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};',
998 ],
999 'conditions' => [
1000 'terms' => [
1001 [
1002 'name' => 'styles_carousel_arrows_position',
1003 'operator' => '!=',
1004 'value' => 'wdk_slider_arrows_middle',
1005 ]
1006 ],
1007 ],
1008 ]
1009 );
1010
1011 $this->add_responsive_control(
1012 'styles_carousel_arrows_icon_left_h',
1013 [
1014 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
1015 'type' => Controls_Manager::HEADING,
1016 'separator' => 'before',
1017 ]
1018 );
1019
1020 $this->add_responsive_control(
1021 'styles_carousel_arrows_s_m_left_margin',
1022 [
1023 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
1024 'type' => Controls_Manager::DIMENSIONS,
1025 'size_units' => [ 'px', 'em', '%' ],
1026 'allowed_dimensions' => 'horizontal',
1027 'selectors' => [
1028 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
1029 ],
1030 ]
1031 );
1032
1033 $this->add_responsive_control(
1034 'styles_carousel_arrows_icon_left',
1035 [
1036 'label' => esc_html__('Icon', 'wpdirectorykit'),
1037 'type' => Controls_Manager::ICONS,
1038 'label_block' => true,
1039 'default' => [
1040 'value' => 'fa fa-angle-left',
1041 'library' => 'solid',
1042 ],
1043 ]
1044 );
1045
1046 $this->add_responsive_control(
1047 'styles_carousel_arrows_icon_right_h',
1048 [
1049 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
1050 'type' => Controls_Manager::HEADING,
1051 'separator' => 'before',
1052 ]
1053 );
1054
1055 $this->add_responsive_control(
1056 'styles_carousel_arrows_s_m_right_margin',
1057 [
1058 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
1059 'type' => Controls_Manager::DIMENSIONS,
1060 'size_units' => [ 'px', 'em', '%' ],
1061 'allowed_dimensions' => 'horizontal',
1062 'selectors' => [
1063 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
1064 ],
1065 ]
1066 );
1067
1068 $this->add_responsive_control(
1069 'styles_carousel_arrows_icon_right',
1070 [
1071 'label' => esc_html__('Icon', 'wpdirectorykit'),
1072 'type' => Controls_Manager::ICONS,
1073 'label_block' => true,
1074 'default' => [
1075 'value' => 'fa fa-angle-right',
1076 'library' => 'solid',
1077 ],
1078 ]
1079 );
1080
1081 $selectors = array(
1082 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
1083 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
1084 );
1085 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['typo','color','background','border','border_radius','padding','shadow','transition']);
1086
1087 $this->end_controls_section();
1088
1089 $this->start_controls_section(
1090 'styles_carousel_dots_section',
1091 [
1092 'label' => esc_html__('Section Dots', 'wpdirectorykit'),
1093 'tab' => Controls_Manager::TAB_STYLE,
1094 'conditions' => [
1095 'terms' => [
1096 [
1097 'name' => 'layout_type',
1098 'operator' => '==',
1099 'value' => 'carousel',
1100 ]
1101 ],
1102 ],
1103 ]
1104 );
1105
1106 $this->add_responsive_control(
1107 'styles_carousel_dots_hide',
1108 [
1109 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1110 'type' => Controls_Manager::SWITCHER,
1111 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1112 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1113 'return_value' => 'none',
1114 'default' => '',
1115 'selectors' => [
1116 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
1117 ],
1118 ]
1119 );
1120
1121 $this->add_responsive_control(
1122 'styles_carousel_dots_position_style',
1123 [
1124 'label' => __( 'Position Style', 'wpdirectorykit' ),
1125 'type' => \Elementor\Controls_Manager::SELECT,
1126 'default' => 'wdk_slider_dots_out',
1127 'options' => [
1128 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
1129 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
1130 ],
1131 ]
1132 );
1133
1134 $this->add_responsive_control(
1135 'styles_carousel_dots_align',
1136 [
1137 'label' => __( 'Position', 'wpdirectorykit' ),
1138 'type' => Controls_Manager::CHOOSE,
1139 'options' => [
1140 'left' => [
1141 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1142 'icon' => 'eicon-text-align-left',
1143 ],
1144 'center' => [
1145 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1146 'icon' => 'eicon-text-align-center',
1147 ],
1148 'right' => [
1149 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1150 'icon' => 'eicon-text-align-right',
1151 ],
1152 'justify' => [
1153 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1154 'icon' => 'eicon-text-align-justify',
1155 ],
1156 ],
1157 'render_type' => 'ui',
1158 'selectors_dictionary' => [
1159 'left' => 'justify-content: flex-start;',
1160 'center' => 'justify-content: center;',
1161 'right' => 'justify-content: flex-end;',
1162 'justify' => 'justify-content: space-between;',
1163 ],
1164 'selectors' => [
1165 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};',
1166 ],
1167 ]
1168 );
1169
1170 $this->add_responsive_control(
1171 'styles_carousel_dots_icon',
1172 [
1173 'label' => esc_html__('Icon', 'wpdirectorykit'),
1174 'type' => Controls_Manager::ICONS,
1175 'label_block' => true,
1176 'default' => [
1177 'value' => 'fas fa-circle',
1178 'library' => 'solid',
1179 ],
1180 ]
1181 );
1182
1183 $selectors = array(
1184 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot',
1185 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s'
1186 );
1187 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
1188
1189 $this->end_controls_section();
1190 }
1191
1192 private function generate_controls_content() {
1193 $this->start_controls_section(
1194 'content_thumbnail_section',
1195 [
1196 'label' => esc_html__('Colors', 'wpdirectorykit'),
1197 'tab' => '1',
1198 ]
1199 );
1200
1201 $this->add_control(
1202 'content_thumbnail_section_header',
1203 [
1204 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
1205 'type' => Controls_Manager::HEADING,
1206 ]
1207 );
1208
1209 $this->add_responsive_control(
1210 'content_thumbnail_section_d_background',
1211 [
1212 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
1213 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
1214 'type' => Controls_Manager::COLOR,
1215 'selectors' => [
1216 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
1217 ],
1218 ]
1219 );
1220
1221 $this->add_control(
1222 'content_thumbnail_section_header_f',
1223 [
1224 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
1225 'type' => Controls_Manager::HEADING,
1226 ]
1227 );
1228
1229 $this->add_group_control(
1230 Group_Control_Box_Shadow::get_type(),
1231 [
1232 'name' => 'content_thumbnail_section_d_featured',
1233 'exclude' => [
1234 'field_shadow_position',
1235 ],
1236 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
1237 ]
1238 );
1239
1240 $this->end_controls_section();
1241 $items = [
1242 [
1243 'key'=>'content_card',
1244 'label'=> esc_html__('Card', 'wpdirectorykit'),
1245 'selector'=>'.wdk-element .wdk-listing-card',
1246 'options'=>'full',
1247 ],
1248 [
1249 'key'=>'content_label',
1250 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
1251 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
1252 'options'=>'full',
1253 ],
1254 [
1255 'key'=>'content_type',
1256 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
1257 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
1258 'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
1259 'options'=>'full',
1260 ],
1261 [
1262 'key'=>'content_title',
1263 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
1264 'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title',
1265 'options'=>'full',
1266 ],
1267 [
1268 'key'=>'content_description',
1269 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
1270 'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part',
1271 'options'=>'full',
1272 ],
1273 [
1274 'key'=>'content_items',
1275 'label'=> esc_html__('Features part', 'wpdirectorykit'),
1276 'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span',
1277 'options'=>'full',
1278 ],
1279 [
1280 'key'=>'wdk-divider',
1281 'label'=> esc_html__('Divider', 'wpdirectorykit'),
1282 'selector'=>'.wdk-element .wdk-listing-card .wdk-divider',
1283 'options'=>'full',
1284 ],
1285 [
1286 'key'=>'content_price',
1287 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
1288 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price',
1289 'options'=>'full',
1290 ],
1291 [
1292 'key'=>'content_button',
1293 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
1294 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn',
1295 'options'=>'full',
1296 ],
1297 ];
1298
1299 foreach ($items as $item) {
1300 $this->start_controls_section(
1301 $item['key'].'_section',
1302 [
1303 'label' => $item['label'],
1304 'tab' => '1',
1305 ]
1306 );
1307 $this->add_responsive_control(
1308 $item['key'].'_hide',
1309 [
1310 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1311 'type' => Controls_Manager::SWITCHER,
1312 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1313 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1314 'return_value' => 'none',
1315 'default' => '',
1316 'selectors' => [
1317 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
1318 ],
1319 ]
1320 );
1321 $selectors = array(
1322 'normal' => '{{WRAPPER}} '.$item['selector'],
1323 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
1324 );
1325
1326 if(isset($item['is_featured'])) {
1327 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
1328 }
1329
1330 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
1331
1332 /* special for some elements */
1333 if ($item['key'] == 'content_description') {
1334
1335 $this->add_control(
1336 'content_description_limit',
1337 [
1338 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
1339 'type' => \Elementor\Controls_Manager::NUMBER,
1340 'min' => 1,
1341 'max' => 10,
1342 'step' => 1,
1343 'default' => 3,
1344 'selectors' => [
1345 '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};',
1346 ],
1347 ]
1348 );
1349
1350 }
1351 if($item['key'] == 'content_button') {
1352 $this->add_control(
1353 $item['key'].'_icon',
1354 [
1355 'label' => esc_html__('Icon', 'wpdirectorykit'),
1356 'type' => Controls_Manager::ICONS,
1357 'label_block' => true,
1358 'default' => [
1359 'value' => 'fa fa-angle-right',
1360 'library' => 'solid',
1361 ],
1362 ]
1363 );
1364
1365 $selectors = array(
1366 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
1367 );
1368 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
1369 }
1370
1371 if($item['key'] == 'content_label') {
1372 $this->add_control(
1373 $item['key'].'_parent_head',
1374 [
1375 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1376 'type' => Controls_Manager::HEADING,
1377 'separator' => 'before',
1378 ]
1379 );
1380
1381 $selectors = array(
1382 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-over-image-top',
1383 );
1384 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']);
1385 }
1386
1387 if($item['key'] == 'content_items') {
1388 $this->add_control(
1389 $item['key'].'_parent_head',
1390 [
1391 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1392 'type' => Controls_Manager::HEADING,
1393 'separator' => 'before',
1394 ]
1395 );
1396
1397 $selectors = array(
1398 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part',
1399 );
1400 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
1401 }
1402
1403 if($item['key'] == 'content_label') {
1404 $this->add_responsive_control(
1405 $item['key'] .'content_label_positions_y',
1406 [
1407 'label' => __( 'Position Y', 'wpdirectorykit' ),
1408 'type' => Controls_Manager::CHOOSE,
1409 'options' => [
1410 'top' => [
1411 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1412 'icon' => 'eicon-text-align-top',
1413 ],
1414 'center' => [
1415 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1416 'icon' => 'eicon-text-align-center',
1417 ],
1418 'bottom' => [
1419 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1420 'icon' => 'eicon-text-align-bottom',
1421 ],
1422 ],
1423 'default' => 'left',
1424 'render_type' => 'ui',
1425 'selectors_dictionary' => [
1426 'top' => 'top:0;bottom:initial',
1427 'center' => 'top:50%;transform: translateY(-50%)',
1428 'bottom' => 'top:initial;bottom:0',
1429 ],
1430 'selectors' => [
1431 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1432 ],
1433 ]
1434 );
1435
1436 $this->add_responsive_control(
1437 $item['key'] .'content_label_positions_x',
1438 [
1439 'label' => __( 'Position X', 'wpdirectorykit' ),
1440 'type' => Controls_Manager::CHOOSE,
1441 'options' => [
1442 'left' => [
1443 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1444 'icon' => 'eicon-text-align-left',
1445 ],
1446 'center' => [
1447 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1448 'icon' => 'eicon-text-align-center',
1449 ],
1450 'right' => [
1451 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1452 'icon' => 'eicon-text-align-right',
1453 ],
1454 ],
1455 'default' => 'left',
1456 'render_type' => 'ui',
1457 'selectors_dictionary' => [
1458 'left' => 'left:0',
1459 'center' => 'left:50%;transform: translateX(-50%)',
1460 'right' => 'left:initial; right:0',
1461 ],
1462 'selectors' => [
1463 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1464 ],
1465 ]
1466 );
1467 }
1468
1469 if($item['key'] == 'content_type') {
1470 $this->add_responsive_control(
1471 $item['key'] .'content_label_positions_y',
1472 [
1473 'label' => __( 'Position Y', 'wpdirectorykit' ),
1474 'type' => Controls_Manager::CHOOSE,
1475 'options' => [
1476 'top' => [
1477 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1478 'icon' => 'eicon-text-align-top',
1479 ],
1480 'center' => [
1481 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1482 'icon' => 'eicon-text-align-center',
1483 ],
1484 'bottom' => [
1485 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1486 'icon' => 'eicon-text-align-bottom',
1487 ],
1488 ],
1489 'default' => 'left',
1490 'render_type' => 'ui',
1491 'selectors_dictionary' => [
1492 'top' => 'top:0;bottom:initial',
1493 'center' => 'top:50%;transform: translateY(-50%)',
1494 'bottom' => 'top:initial;bottom:0',
1495 ],
1496 'selectors' => [
1497 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1498 ],
1499 ]
1500 );
1501
1502 $this->add_responsive_control(
1503 $item['key'] .'content_label_positions_x',
1504 [
1505 'label' => __( 'Position X', 'wpdirectorykit' ),
1506 'type' => Controls_Manager::CHOOSE,
1507 'options' => [
1508 'left' => [
1509 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1510 'icon' => 'eicon-text-align-left',
1511 ],
1512 'center' => [
1513 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1514 'icon' => 'eicon-text-align-center',
1515 ],
1516 'right' => [
1517 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1518 'icon' => 'eicon-text-align-right',
1519 ],
1520 'justify' => [
1521 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1522 'icon' => 'eicon-text-align-justify',
1523 ],
1524 ],
1525 'default' => 'left',
1526 'render_type' => 'ui',
1527 'selectors_dictionary' => [
1528 'top' => 'justify-content: flex-start;',
1529 'center' => 'justify-content: center;',
1530 'bottom' => 'justify-content: flex-end;',
1531 'justify' => 'justify-content: stretch;',
1532 ],
1533 'selectors' => [
1534 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1535 ],
1536 ]
1537 );
1538 }
1539 $this->end_controls_section();
1540 }
1541
1542 }
1543
1544 public function enqueue_styles_scripts() {
1545 wp_enqueue_style('slick');
1546 wp_enqueue_style('slick-theme');
1547 wp_enqueue_script('slick');
1548
1549 wp_enqueue_style('wdk-notify');
1550 wp_enqueue_script('wdk-notify');
1551 }
1552 }
1553