PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
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.5.9, at elementor-elements/classes/wdk-listing-similar-listings.php

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