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-listings-results.php

wdk-listings-results.php in WP Directory Kit 1.5.9, at elementor-elements/classes/wdk-listings-results.php

3,028 lines 125.3 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_Image_Size;
18 use Elementor\Group_Control_Box_Shadow;
19
20 if (!defined('ABSPATH'))
21 exit; // Exit if accessed directly
22
23 /**
24 * @since 1.1.0
25 */
26 class WdkListingsResults extends WdkElementorBase {
27
28 public function __construct($data = array(), $args = null) {
29
30 \Elementor\Controls_Manager::add_tab(
31 'tab_conf',
32 esc_html__('Settings', 'wpdirectorykit')
33
34 );
35
36 \Elementor\Controls_Manager::add_tab(
37 'tab_layout',
38 esc_html__('Layout', 'wpdirectorykit')
39 );
40
41 \Elementor\Controls_Manager::add_tab(
42 'tab_content',
43 esc_html__('Main', 'wpdirectorykit')
44 );
45
46 if ($this->is_edit_mode_load()) {
47 $this->enqueue_styles_scripts();
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-listings-results';
63 }
64
65 /**
66 * Retrieve the widget title.
67 *
68 * @since 1.1.0
69 *
70 * @access public
71 *
72 * @return string Widget title.
73 */
74 public function get_title() {
75 return esc_html__('Wdk Listings Results', 'wpdirectorykit');
76 }
77
78 /**
79 * Retrieve the widget icon.
80 *
81 * @since 1.1.0
82 *
83 * @access public
84 *
85 * @return string Widget icon.
86 */
87 public function get_icon() {
88 return 'eicon-products';
89 }
90
91 /**
92 * Register the widget controls.
93 *
94 * Adds different input fields to allow the user to change and customize the widget settings.
95 *
96 * @since 1.1.0
97 *
98 * @access protected
99 */
100 protected function register_controls() {
101 $this->generate_controls_conf();
102 $this->generate_controls_layout();
103 $this->generate_controls_styles();
104 $this->generate_controls_content();
105
106 $this->insert_pro_message('tab_conf');
107 parent::register_controls();
108 }
109
110 /**
111 * Render the widget output on the frontend.
112 *
113 * Written in PHP and used to generate the final HTML.
114 *
115 * @since 1.1.0
116 *
117 * @access protected
118 */
119 protected function render() {
120 parent::render();
121 $this->data['id_element'] = $this->get_id();
122 $this->data['settings'] = $this->get_settings();
123
124 $this->data['listings_count'] = 0;
125 $this->data['results'] = array();
126 $this->data['pagination_output'] = '';
127
128 $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by','is_featured', 'address');
129 $external_columns = array('location_id', 'category_id', 'post_title');
130 $custom_parameters = array();
131 $skip_postget = FALSE;
132
133
134 $custom_parameters['order_by'] = $this->WMVC->db->prefix.'wdk_listings.rank DESC';
135
136 if(!empty($this->data['settings']['is_rank_order_disable']))
137 $custom_parameters['order_by'] = '';
138
139 $this->data['custom_order'] = array();
140 if($this->data['settings']['custom_order_list']) {
141 foreach($this->data['settings']['custom_order_list'] as $item){
142 if(empty($item['title']) || empty($item['key'])) continue;
143
144 /* compatible with old settings */
145 if(stripos($item['key'], 'ASC') !== FALSE || stripos($item['key'], 'DESC') !== FALSE) {
146 $item['order_type'] = '';
147 }
148
149 $this->data['custom_order'][] = array('title'=>$item['title'],'key'=>$item['key'],'order_type'=>$item['order_type']);
150
151 }
152 }
153
154 if(!empty($this->data['settings']['specific_user'])) {
155 $custom_parameters['search_agents_ids'] = $this->data['settings']['specific_user'];
156 }
157
158 if($this->data['settings']['conf_results_type'] == 'results_listings') {
159 $controller = 'listing';
160 $offset = NULL;
161
162 if($this->data['settings']['get_filters_enable'] != 'yes')
163 $skip_postget = TRUE;
164
165 if(!isset($_GET['order_by'])) {
166 /* if detected custom field for order */
167 if(!empty($this->data['settings']['conf_order_by_custom']) && $this->data['settings']['conf_order_by_custom'] == 'rand()') {
168 $custom_parameters['order_by'] = $this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order'];
169 } elseif(!empty($this->data['settings']['conf_order_by_custom'])) {
170 $custom_parameters['order_by'] .= ((!empty($custom_parameters['order_by'])) ? ', ':'').$this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order'];
171 } else {
172 $custom_parameters['order_by'] .= ((!empty($custom_parameters['order_by'])) ? ', ':'').$this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'];
173 }
174 }
175
176 if(!empty($this->data['settings']['conf_query'])) {
177 $qr_string = trim($this->data['settings']['conf_query'],'?');
178 $string_par = array();
179 parse_str($qr_string, $string_par);
180 $custom_parameters += array_map('trim', $string_par);
181 }
182
183 if($this->data['settings']['only_is_featured'] == 'yes') {
184 $custom_parameters['is_featured'] = 'on';
185 }
186
187 if(isset($custom_parameters['search_rank'])) {
188 $custom_parameters['search_rank_'.NONCE_KEY] = $custom_parameters['search_rank'];
189 }
190
191 if($this->data['settings']['conf_pagination_enable'] == 'yes' && $this->data['settings']['get_filters_enable'] == 'yes') {
192
193 wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, $skip_postget);
194 $total_items = $this->WMVC->listing_m->total(array('is_activated' => 1,'is_approved'=>1));
195 $current_page = 1;
196 if(isset($_GET['wmvc_paged']))
197 $current_page = intval(wmvc_xss_clean($_GET['wmvc_paged']));
198
199 if(empty($this->data['settings']['per_page']))
200 $this->data['settings']['per_page'] = 6;
201
202 $offset = $this->data['settings']['per_page']*($current_page-1);
203
204 if(function_exists('wdk_wp_frontend_paginate') && $total_items > $this->data['settings']['per_page'])
205 $this->data['pagination_output'] = wdk_wp_frontend_paginate($total_items, $this->data['settings']['per_page'], 'wmvc_paged', array(), TRUE,
206 FALSE, FALSE, $this->data['settings']['limit_pagination']);
207
208 $this->data['listings_count'] = $total_items;
209 } else {
210 wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, $skip_postget);
211 $total_items = $this->WMVC->listing_m->total(array('is_activated' => 1,'is_approved'=>1));
212
213 $this->data['listings_count'] = $total_items;
214 }
215
216 wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, $skip_postget);
217
218 $this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['per_page'], $offset, array('is_activated' => 1,'is_approved'=>1));
219 $this->data['results'] = apply_filters('wdk/listings/results', $this->data['results']);
220
221 /*, array('sw_listing.rank DESC')*/
222
223 } else if($this->data['settings']['conf_results_type'] == 'custom_listings') {
224 $listings_ids = array();
225 foreach($this->data['settings']['conf_custom_results'] as $listing) {
226 if(isset($listing['listing_post_id']) && !empty($listing['listing_post_id'])) {
227 $listings_ids [] = $listing['listing_post_id'];
228 }
229 }
230
231 if($this->data['settings']['layout_type'] != 'carousel' && $this->data['settings']['custom_listings_enable_pagination'] == 'yes' && !empty($this->data['settings']['custom_listings_per_page'])) {
232
233 $this->data['listings_count'] = $total_items = 0;
234
235 if(!empty($listings_ids))
236 {
237 $this->WMVC->db->where( $this->WMVC->db->prefix.'wdk_listings.post_id IN(' . implode(',', $listings_ids) . ')', null, false);
238 $total_items = $this->WMVC->listing_m->total(array('is_activated' => 1,'is_approved'=>1));
239 $this->data['listings_count'] = $total_items;
240 }
241
242 $current_page = 1;
243 if(isset($_GET['wmvc_paged']))
244 $current_page = intval(wmvc_xss_clean($_GET['wmvc_paged']));
245
246 $limit = $this->data['settings']['custom_listings_per_page'];
247
248 $offset = $limit *($current_page-1);
249
250 if(function_exists('wdk_wp_frontend_paginate'))
251 $this->data['pagination_output'] = wdk_wp_frontend_paginate($total_items, $limit, 'wmvc_paged', array(), TRUE, FALSE, FALSE,
252 $this->data['settings']['limit_pagination']);
253
254 $this->WMVC->db->limit($limit);
255 $this->WMVC->db->offset($offset);
256 }
257
258 /* where in */
259 if(!empty($listings_ids)){
260 $this->WMVC->db->where( $this->WMVC->db->prefix.'wdk_listings.post_id IN(' . implode(',', $listings_ids) . ')', null, false);
261 $this->WMVC->db->where(array('is_activated' => 1, 'is_approved'=>1));
262 $this->WMVC->db->order_by('FIELD('.$this->WMVC->db->prefix.'wdk_listings.post_id, '. implode(',', $listings_ids) . ')');
263
264 if($this->data['settings']['conf_pagination_enable'] == 'yes' && !empty($this->data['settings']['per_page'])) {
265
266
267 }
268 $this->data['results'] = $this->WMVC->listing_m->get();
269 }
270
271 /* hide filter header on specific results */
272 $this->data['settings']['get_filters_enable'] = '';
273 }
274
275 if(!empty($this->data['results']) && $this->data['listings_count'] == 0)
276 $this->data['listings_count'] = wmvc_count($this->data['results']);
277
278 $this->data['settings']['content_button_icon'] = $this->generate_icon($this->data['settings']['content_button_icon']);
279
280 $this->data['is_edit_mode'] = false;
281 if(Plugin::$instance->editor->is_edit_mode())
282 $this->data['is_edit_mode'] = true;
283
284 if(isset($_GET['wmvc_view_type']) && $this->data['settings']['get_filters_enable'] == 'yes') {
285 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'grid')
286 $this->data['settings']['layout_type'] = 'grid';
287 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'list')
288 $this->data['settings']['layout_type'] = 'list';
289 }
290
291 $this->view('wdk-listings-results', $this->data, true);
292 }
293
294
295 private function generate_controls_conf() {
296 $this->start_controls_section(
297 'tab_conf_main_section',
298 [
299 'label' => esc_html__('Main', 'wpdirectorykit'),
300 'tab' => 'tab_conf',
301 ]
302 );
303
304 $this->add_control(
305 'is_rank_order_disable',
306 [
307 'label' => __( 'Disable top rank', 'wpdirectorykit' ),
308 'type' => \Elementor\Controls_Manager::SWITCHER,
309 'label_on' => __( 'True', 'wpdirectorykit' ),
310 'label_off' => __( 'False', 'wpdirectorykit' ),
311 'return_value' => 'yes',
312 'default' => '',
313
314 ]
315 );
316
317 $this->add_control(
318 'is_complete_link',
319 [
320 'label' => __( 'Complete Card Link', 'wpdirectorykit' ),
321 'description' => __( 'Make Full Card like Link', 'wpdirectorykit' ),
322 'type' => \Elementor\Controls_Manager::SWITCHER,
323 'label_on' => __( 'True', 'wpdirectorykit' ),
324 'label_off' => __( 'False', 'wpdirectorykit' ),
325 'return_value' => 'yes',
326 'default' => '',
327 ]
328 );
329
330
331 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')){
332 $this->add_control(
333 'is_ajax_enable',
334 [
335 'label' => __( 'Enable Reload content with ajax', 'wpdirectorykit' ),
336 'type' => \Elementor\Controls_Manager::SWITCHER,
337 'label_on' => __( 'True', 'wpdirectorykit' ),
338 'label_off' => __( 'False', 'wpdirectorykit' ),
339 'return_value' => 'yes',
340 'default' => '',
341
342 ]
343 );
344 }
345
346 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
347 $this->add_control(
348 'is_custom_layout_enable',
349 [
350 'label' => __( 'Enable Custom Layout', 'wpdirectorykit' ),
351 'type' => \Elementor\Controls_Manager::SWITCHER,
352 'label_on' => __( 'True', 'wpdirectorykit' ),
353 'label_off' => __( 'False', 'wpdirectorykit' ),
354 'return_value' => 'yes',
355 'default' => '',
356
357 ]
358 );
359
360
361 /*
362 https://wpdirectorykit.com/create-nice-listings-card-in-element-builder/
363 */
364
365 // Template title (always visible)
366 $this->add_control(
367 'custom_layout_live_grid',
368 array(
369 'label' => __( 'Template Id', 'wpdirectorykit' ),
370 'type' => Controls_Manager::TEXT,
371 'classes' => 'wdk-live-temp-title control-hidden',
372 'label_block' => true,
373 'placeholder' => __( 'Enter template name...', 'wpdirectorykit' ),
374 'separator' => 'before',
375 'conditions' => [
376 'terms' => [
377 [
378 'name' => 'is_custom_layout_enable',
379 'operator' => '==',
380 'value' => 'yes',
381 ]
382 ],
383 ],
384 )
385 );
386
387 // Smart Create/Edit template button (always visible)
388 $this->add_control(
389 'custom_layout_id_grid_item_live',
390 array(
391 'type' => Controls_Manager::BUTTON,
392 'label_block' => true,
393 'button_type' => 'default papro-btn-block for-custom_layout_live_grid',
394 'text' => __( 'Create / Edit Template', 'wpdirectorykit' ),
395 'event' => 'wdkCreateLiveTemp',
396 'conditions' => [
397 'terms' => [
398 [
399 'name' => 'is_custom_layout_enable',
400 'operator' => '==',
401 'value' => 'yes',
402 ]
403 ],
404 ],
405 )
406 );
407
408 $this->add_control(
409 'custom_layout_id_grid',
410 array(
411 'label' => __( 'OR Select Existing Template', 'wpdirectorykit' ),
412 //'type' => \Wdk\Includes\Controls\Wdk_Post_Filter::TYPE,
413 'type' => Controls_Manager::SELECT2,
414 'options' => $this->get_elementor_templates(),
415 'description' => __( 'Create layout here', 'wpdirectorykit' ) . ' ' . wdk_sprintf(
416 /* translators: 1: Tag with link open, 2: close link tag. */
417 __('%1$s here %2$s', 'wpdirectorykit'),
418 '<a target="_blank" href="' . admin_url('edit.php?post_type=elementor_library#add_new') . '">',
419 '</a>'
420 ),
421 'label_block' => true,
422 'multiple' => false,
423 'source' => 'elementor_library',
424 'separator' => 'after',
425 'conditions' => [
426 'terms' => [
427 [
428 'name' => 'is_custom_layout_enable',
429 'operator' => '==',
430 'value' => 'yes',
431 ]
432 ],
433 ],
434 )
435 );
436
437 $this->add_control(
438 'custom_layout_live_list',
439 array(
440 'label' => __( 'Template Id', 'wpdirectorykit' ),
441 'type' => Controls_Manager::TEXT,
442 'classes' => 'wdk-live-temp-title control-hidden',
443 'label_block' => true,
444 'placeholder' => __( 'Enter template name...', 'wpdirectorykit' ),
445 'conditions' => [
446 'terms' => [
447 [
448 'name' => 'is_custom_layout_enable',
449 'operator' => '==',
450 'value' => 'yes',
451 ]
452 ],
453 ],
454 )
455 );
456
457 $this->add_control(
458 'custom_layout_id_list_item_live',
459 array(
460 'type' => Controls_Manager::BUTTON,
461 'label_block' => true,
462 'button_type' => 'default papro-btn-block for-custom_layout_live_list',
463 'text' => __( 'Create / Edit Template', 'wpdirectorykit' ),
464 'event' => 'wdkCreateLiveTemp',
465 'conditions' => [
466 'terms' => [
467 [
468 'name' => 'is_custom_layout_enable',
469 'operator' => '==',
470 'value' => 'yes',
471 ]
472 ],
473 ],
474 )
475 );
476
477 $this->add_control(
478 'custom_layout_id_list',
479 array(
480 'label' => __( 'OR Select Existing Template', 'wpdirectorykit' ),
481 'type' => Controls_Manager::SELECT2,
482 'options' => $this->get_elementor_templates(),
483 'description' => __( 'Create layout here', 'wpdirectorykit' ) . ' ' . wdk_sprintf(
484 /* translators: 1: Tag with link open, 2: close link tag. */
485 __('%1$s here %2$s', 'wpdirectorykit'),
486 '<a target="_blank" href="' . admin_url('edit.php?post_type=elementor_library#add_new') . '">',
487 '</a>'
488 ),
489 'label_block' => true,
490 'multiple' => false,
491 'source' => 'elementor_library',
492 'separator' => 'after',
493 'conditions' => [
494 'terms' => [
495 [
496 'name' => 'is_custom_layout_enable',
497 'operator' => '==',
498 'value' => 'yes',
499 ]
500 ],
501 ],
502 )
503 );
504
505 }
506
507
508 $this->add_control(
509 'specific_user_hr',
510 [
511 'type' => \Elementor\Controls_Manager::DIVIDER,
512 ]
513 );
514
515 $this->add_control(
516 'is_mobile_view_enable',
517 [
518 'label' => __( 'Horizontal mobile view', 'wpdirectorykit' ),
519 'type' => \Elementor\Controls_Manager::SWITCHER,
520 'label_on' => __( 'True', 'wpdirectorykit' ),
521 'label_off' => __( 'False', 'wpdirectorykit' ),
522 'return_value' => 'yes',
523 'default' => '',
524 ]
525 );
526
527 $this->add_control(
528 'conf_results_type',
529 [
530 'label' => __( 'Results type', 'wpdirectorykit' ),
531 'type' => \Elementor\Controls_Manager::SELECT,
532 'default' => 'results_listings',
533 'options' => [
534 'results_listings' => __( 'Results Listings', 'wpdirectorykit' ),
535 'custom_listings' => __( 'Specific Listings', 'wpdirectorykit' ),
536 ],
537 'separator' => 'after',
538 ]
539 );
540
541 $this->add_control(
542 'get_filters_enable',
543 [
544 'label' => __( 'Filtering based on URL enable', 'wpdirectorykit' ),
545 'type' => \Elementor\Controls_Manager::SWITCHER,
546 'label_on' => __( 'True', 'wpdirectorykit' ),
547 'label_off' => __( 'False', 'wpdirectorykit' ),
548 'return_value' => 'yes',
549 'default' => 'yes',
550 'conditions' => [
551 'terms' => [
552 [
553 'name' => 'conf_results_type',
554 'operator' => '==',
555 'value' => 'results_listings',
556 ]
557 ],
558 ],
559 ]
560 );
561
562 $this->add_control(
563 'show_numbers_results_enable',
564 [
565 'label' => __( 'Show number of results Enable', 'wpdirectorykit' ),
566 'type' => \Elementor\Controls_Manager::SWITCHER,
567 'label_on' => __( 'True', 'wpdirectorykit' ),
568 'label_off' => __( 'False', 'wpdirectorykit' ),
569 'return_value' => 'yes',
570 'default' => 'yes',
571 'conditions' => [
572 'terms' => [
573 [
574 'name' => 'conf_results_type',
575 'operator' => '==',
576 'value' => 'results_listings',
577 ]
578 ],
579 ],
580 ]
581 );
582
583 $this->add_control(
584 'view_type_enable',
585 [
586 'label' => __( 'View Type Grid/List Enable', 'wpdirectorykit' ),
587 'type' => \Elementor\Controls_Manager::SWITCHER,
588 'label_on' => __( 'True', 'wpdirectorykit' ),
589 'label_off' => __( 'False', 'wpdirectorykit' ),
590 'return_value' => 'yes',
591 'default' => 'yes',
592 'conditions' => [
593 'terms' => [
594 [
595 'name' => 'conf_results_type',
596 'operator' => '==',
597 'value' => 'results_listings',
598 ]
599 ],
600 ],
601 ]
602 );
603
604 $this->add_control(
605 'sorting_enable',
606 [
607 'label' => __( 'Sorting Filter Enable', 'wpdirectorykit' ),
608 'type' => \Elementor\Controls_Manager::SWITCHER,
609 'label_on' => __( 'True', 'wpdirectorykit' ),
610 'label_off' => __( 'False', 'wpdirectorykit' ),
611 'return_value' => 'yes',
612 'default' => 'yes',
613 'conditions' => [
614 'terms' => [
615 [
616 'name' => 'conf_results_type',
617 'operator' => '==',
618 'value' => 'results_listings',
619 ]
620 ],
621 ],
622 ]
623 );
624
625 $this->add_control(
626 'conf_pagination_enable',
627 [
628 'label' => __( 'Pagination Enable', 'wpdirectorykit' ),
629 'type' => \Elementor\Controls_Manager::SWITCHER,
630 'label_on' => __( 'Show', 'wpdirectorykit' ),
631 'label_off' => __( 'Hide', 'wpdirectorykit' ),
632 'return_value' => 'yes',
633 'default' => '',
634 'description' => esc_html__( 'Filtering based on URL must be enabled for this functionality', 'wpdirectorykit' ),
635 'conditions' => [
636 'terms' => [
637 [
638 'name' => 'conf_results_type',
639 'operator' => '==',
640 'value' => 'results_listings',
641 ],/*
642 [
643 'name' => 'get_filters_enable',
644 'operator' => '==',
645 'value' => 'yes',
646 ]*/
647 ],
648 ]
649 ]
650 );
651
652 $this->add_control(
653 'limit_pagination',
654 [
655 'label' => __('Limit Pagination Items', 'wpdirectorykit'),
656 'type' => Controls_Manager::SELECT,
657 'label_block' => true,
658 'options' => [
659 '1' => __('3 numbers', 'wpdirectorykit'),
660 '2' => __('5 numbers', 'wpdirectorykit'),
661 '3' => __('7 numbers', 'wpdirectorykit'),
662 ],
663 'default' => '1',
664 ]
665 );
666
667 /* conf_results_type :: results_listings */
668 if(true){
669 $this->add_control(
670 'conf_results_type_results_listings_header',
671 [
672 'label' => esc_html__('Results listings', 'wpdirectorykit'),
673 'type' => Controls_Manager::HEADING,
674 'separator' => 'before',
675 'conditions' => [
676 'terms' => [
677 [
678 'name' => 'conf_results_type',
679 'operator' => '==',
680 'value' => 'results_listings',
681 ]
682 ],
683 ],
684 ]
685 );
686
687 $this->add_control(
688 'per_page',
689 [
690 'label' => __( 'Limit Results (Per page)', 'wpdirectorykit' ),
691 'type' => \Elementor\Controls_Manager::NUMBER,
692 'min' => 1,
693 'max' => 250,
694 'step' => 1,
695 'default' => 6,
696 'conditions' => [
697 'terms' => [
698 [
699 'name' => 'conf_results_type',
700 'operator' => '==',
701 'value' => 'results_listings',
702 ]
703 ],
704 ],
705 ]
706 );
707
708 $this->add_control(
709 'only_is_featured',
710 [
711 'label' => __( 'Only show featured', 'wpdirectorykit' ),
712 'type' => \Elementor\Controls_Manager::SWITCHER,
713 'label_on' => __( 'True', 'wpdirectorykit' ),
714 'label_off' => __( 'False', 'wpdirectorykit' ),
715 'return_value' => 'yes',
716 'default' => '',
717 'conditions' => [
718 'terms' => [
719 [
720 'name' => 'conf_results_type',
721 'operator' => '==',
722 'value' => 'results_listings',
723 ]
724 ],
725 ],
726 ]
727 );
728
729 $this->add_control(
730 'conf_query',
731 [
732 'label' => __( 'Query', 'wpdirectorykit' ),
733 'type' => \Elementor\Controls_Manager::TEXTAREA,
734 'rows' => 5,
735 'default' => '',
736 'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ),
737 'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url):', 'wpdirectorykit' ).
738 '<br> field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4&search_agents_ids=3'.
739 '<br> Listings by post id - field_post_id=5169,5157,5159'.
740 '<br> Listings from date - field_post_date_min=2023-05-07'.
741 '<br> Listings from latest 365 days - field_post_date_min=-365 days'.
742 '<br> Filter based on rank - search_rank=1 OR search_rank_min=1 OR search_rank_max=3'.
743 '</span>',
744 'conditions' => [
745 'terms' => [
746 [
747 'name' => 'conf_results_type',
748 'operator' => '==',
749 'value' => 'results_listings',
750 ]
751 ],
752 ],
753 ]
754 );
755
756
757 $dbusers = get_users( array( 'search' => '',
758 'orderby' => 'display_name', 'order' => 'ASC', 'role__in' => [ 'administrator', 'super-admin','wdk_agent','wdk_agency']));
759
760 $users = array('0'=>esc_html__('Not Selected', 'wpdirectorykit'));
761 foreach($dbusers as $dbuser) {
762 $users[wmvc_show_data('ID', $dbuser)] = '#'.wmvc_show_data('ID', $dbuser).', '.wmvc_show_data('display_name', $dbuser);
763 }
764
765 $this->add_control(
766 'specific_user',
767 [
768 'label' => __( 'Filter by Agent', 'wpdirectorykit' ),
769 'type' => \Elementor\Controls_Manager::SELECT,
770 'default' => '0',
771 'label_block' => true,
772 'options' => $users,
773 ]
774 );
775
776 $this->add_control(
777 'conf_order_by',
778 [
779 'label' => __('Default Sort By Column', 'wpdirectorykit'),
780 'type' => Controls_Manager::SELECT,
781 'label_block' => true,
782 'options' => [
783 'none' => __('None', 'wpdirectorykit'),
784 'post_id' => __('ID', 'wpdirectorykit'),
785 'post_title' => __('Title', 'wpdirectorykit'),
786 ],
787 'default' => 'post_id',
788 'conditions' => [
789 'terms' => [
790 [
791 'name' => 'conf_results_type',
792 'operator' => '==',
793 'value' => 'results_listings',
794 ]
795 ],
796 ],
797 ]
798 );
799
800 $this->add_control(
801 'conf_order_by_custom',
802 [
803 'label' => __('Default Custom Sort By', 'wpdirectorykit'),
804 'description' => __('Custom Sort By', 'wpdirectorykit'),
805 'description' => '<span style="word-break: break-all;">'.__( 'Example:', 'wpdirectorykit' ).
806 '<br> wp_rand() - return random results'.
807 '<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'.
808 '<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'.
809 '<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'.
810 '<br> category_title - Category Title'.
811 '<br> location_title - Location Title'.
812 '</span>',
813 'type' => Controls_Manager::TEXT,
814 'label_block' => true,
815 'default' => 'post_id',
816 'conditions' => [
817 'terms' => [
818 [
819 'name' => 'conf_results_type',
820 'operator' => '==',
821 'value' => 'results_listings',
822 ]
823 ],
824 ],
825 ]
826 );
827
828
829 $this->add_control(
830 'conf_order',
831 [
832 'label' => __('Default Listing Order', 'wpdirectorykit'),
833 'type' => Controls_Manager::SELECT,
834 'label_block' => true,
835 'options' => [
836 'asc' => __('Ascending', 'wpdirectorykit'),
837 'desc' => __('Descending', 'wpdirectorykit')
838 ],
839 'default' => 'desc',
840 'conditions' => [
841 'terms' => [
842 [
843 'name' => 'conf_results_type',
844 'operator' => '==',
845 'value' => 'results_listings',
846 ]
847 ],
848 ],
849 ]
850 );
851 }
852
853 if(true) {
854
855
856 $this->add_control(
857 'conf_results_type_custom_listings_header',
858 [
859 'label' => esc_html__('Custom listings', 'wpdirectorykit'),
860 'type' => Controls_Manager::HEADING,
861 'separator' => 'before',
862 'conditions' => [
863 'terms' => [
864 [
865 'name' => 'conf_results_type',
866 'operator' => '==',
867 'value' => 'custom_listings',
868 ]
869 ],
870 ],
871 ]
872 );
873
874 $this->add_control(
875 'custom_listings_enable_pagination',
876 [
877 'label' => __( 'Enable Pagination', 'wpdirectorykit' ),
878 'type' => \Elementor\Controls_Manager::SWITCHER,
879 'label_on' => __( 'True', 'wpdirectorykit' ),
880 'label_off' => __( 'False', 'wpdirectorykit' ),
881 'return_value' => 'yes',
882 'default' => '',
883 'conditions' => [
884 'terms' => [
885 [
886 'name' => 'conf_results_type',
887 'operator' => '==',
888 'value' => 'custom_listings',
889 ]
890 ],
891 ],
892 ]
893 );
894
895 $this->add_control(
896 'custom_listings_per_page',
897 [
898 'label' => __( 'Limit Listings (Per page)', 'wpdirectorykit' ),
899 'type' => \Elementor\Controls_Manager::NUMBER,
900 'min' => 1,
901 'max' => 50,
902 'step' => 1,
903 'default' => 6,
904 'conditions' => [
905 'terms' => [
906 [
907 'name' => 'conf_results_type',
908 'operator' => '==',
909 'value' => 'custom_listings',
910 ],
911 [
912 'name' => 'custom_listings_enable_pagination',
913 'operator' => '==',
914 'value' => 'yes',
915 ]
916 ],
917 ],
918 ]
919 );
920
921
922 if(true){
923 $repeater = new Repeater();
924 $repeater->start_controls_tabs( 'listings' );
925 $repeater->add_control(
926 'listing_post_id',
927 [
928 'label' => __( 'ID Post Listing', 'wpdirectorykit' ),
929 'type' => \Elementor\Controls_Manager::NUMBER,
930 'min' => 1,
931 'step' => 1,
932 ]
933 );
934 $repeater->end_controls_tabs();
935
936
937 $this->add_control(
938 'conf_custom_results',
939 [
940 'type' => Controls_Manager::REPEATER,
941 'fields' => $repeater->get_controls(),
942 'default' => [
943 ],
944 'title_field' => '{{{ listing_post_id }}}',
945 'conditions' => [
946 'terms' => [
947 [
948 'name' => 'conf_results_type',
949 'operator' => '==',
950 'value' => 'custom_listings',
951 ]
952 ],
953 ],
954 ]
955 );
956
957 }
958 }
959
960 $this->add_control(
961 'important_note',
962 [
963 'label' => '',
964 'type' => \Elementor\Controls_Manager::RAW_HTML,
965 /* translators: 1: URL. */
966 'raw' => wdk_sprintf(__( 'Edit Result Card Designer <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_resultitem')),
967 'content_classes' => 'wdk_elementor_hint',
968 ]
969 );
970
971 $this->end_controls_section();
972
973 $this->start_controls_section(
974 'tab_conf_main_section_order',
975 [
976 'label' => esc_html__('Custom Sort', 'wpdirectorykit'),
977 'tab' => 'tab_conf',
978 ]
979 );
980
981 $repeater_order = new Repeater();
982 $repeater_order->start_controls_tabs( 'orders' );
983
984 $fields_data = wdk_cached_field_get();
985 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
986 $order_i = 0;
987 $fields_number_types = array();
988 $fields_list[(++$order_i) . '__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
989 $fields_list[(++$order_i) . '__post_id'] = esc_html__('Post Id', 'wpdirectorykit');
990 $fields_list[(++$order_i) . '__counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
991 $fields_list[(++$order_i) . '__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
992 $fields_list[(++$order_i) . '__post_title'] = esc_html__('WP Title', 'wpdirectorykit');
993 $fields_list[(++$order_i) . '__address'] = esc_html__('Address', 'wpdirectorykit');
994 $fields_list[(++$order_i) . '__category_id'] = esc_html__('Category', 'wpdirectorykit');
995 $fields_list[(++$order_i) . '__location_id'] = esc_html__('Location', 'wpdirectorykit');
996
997 foreach ($fields_data as $field) {
998 if (wmvc_show_data('field_type', $field) == 'SECTION') {
999 $fields_list[(++$order_i) . 'section__' . wmvc_show_data('idfield', $field)] = '-- ' . esc_html__('Section', 'wpdirectorykit') . ' ' . wmvc_show_data('field_label', $field) . ' --';
1000 } else if(wmvc_show_data('field_type', $field) != 'FILEUPLOAD') {
1001 $fields_list[(++$order_i) . '__field_' . wmvc_show_data('idfield', $field)] = '#' . wmvc_show_data('idfield', $field) . ' ' . wmvc_show_data('field_label', $field) . '[' . wmvc_show_data('field_type', $field) . ']';
1002 }
1003 }
1004
1005 $repeater_order->add_control(
1006 'key',
1007 [
1008 'label' => __('Field Id', 'wpdirectorykit'),
1009 'type' => \Elementor\Controls_Manager::SELECT2,
1010 'default' => '',
1011 'options' => $fields_list,
1012 ]
1013 );
1014
1015 // Add select for order type "Ask or Desk", default ASK
1016 $repeater_order->add_control(
1017 'order_type',
1018 [
1019 'label' => __('Order Type', 'wpdirectorykit'),
1020 'type' => \Elementor\Controls_Manager::SELECT,
1021 'default' => 'asc',
1022 'options' => [
1023 'ASC' => __('ASC', 'wpdirectorykit'),
1024 'DESC' => __('DESC', 'wpdirectorykit'),
1025 ],
1026 ]
1027 );
1028
1029
1030 $repeater_order->add_control(
1031 'title',
1032 [
1033 'label' => __( 'Title', 'wpdirectorykit' ),
1034 'type' => \Elementor\Controls_Manager::TEXT,
1035 'placeholder' => __( 'Title', 'wpdirectorykit' ),
1036 ]
1037 );
1038 $repeater_order->end_controls_tabs();
1039
1040 $this->add_control(
1041 'custom_order_list',
1042 [
1043 'type' => Controls_Manager::REPEATER,
1044 'fields' => $repeater_order->get_controls(),
1045 'default' => [
1046 ],
1047 'title_field' => '{{{ title }}}',
1048 ]
1049 );
1050
1051 $this->end_controls_section();
1052
1053
1054 if(wdk_get_option('wdk_sub_listings_enable')) {
1055
1056 $this->start_controls_section(
1057 'tab_conf_main_section_subslistings',
1058 [
1059 'label' => esc_html__('Related Listings', 'wpdirectorykit'),
1060 'tab' => 'tab_conf',
1061 ]
1062 );
1063
1064 $fields_data = wdk_cached_field_get();
1065 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
1066 $order_i = 0;
1067
1068 $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
1069 $fields_list [(++$order_i).'__idlisting'] = esc_html__('Id listing', 'wpdirectorykit');
1070 $fields_list [(++$order_i).'__post_id'] = esc_html__('Post Id', 'wpdirectorykit');
1071 $fields_list [(++$order_i).'__counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
1072 $fields_list [(++$order_i).'__lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
1073 $fields_list [(++$order_i).'__lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
1074 $fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit');
1075 $fields_list [(++$order_i).'__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
1076 $fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit');
1077 $fields_list [(++$order_i).'__post_content'] = esc_html__('WP Content', 'wpdirectorykit');
1078 $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit');
1079 $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit');
1080 $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit');
1081
1082 foreach($fields_data as $field)
1083 {
1084 if(wmvc_show_data('field_type', $field) == 'SECTION') {
1085 $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
1086 } else {
1087 $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
1088 }
1089 }
1090
1091 $this->add_responsive_control(
1092 'related_fields_header',
1093 [
1094 'label' => esc_html__('Fields', 'wpdirectorykit'),
1095 'type' => Controls_Manager::HEADING,
1096 ]
1097 );
1098
1099 $this->add_control(
1100 'related_fields_header_hr',
1101 [
1102 'type' => \Elementor\Controls_Manager::DIVIDER,
1103 ]
1104 );
1105
1106 $repeater_sublistings_fields = new Repeater();
1107 $repeater_sublistings_fields->start_controls_tabs( 'related_fields' );
1108 $repeater_sublistings_fields->add_control(
1109 'field',
1110 [
1111 'label' => __( 'Field', 'wpdirectorykit' ),
1112 'type' => \Elementor\Controls_Manager::SELECT2,
1113 'options' => $fields_list,
1114 ]
1115 );
1116
1117 $repeater_sublistings_fields->add_control(
1118 'is_stars',
1119 [
1120 'label' => __( 'Show like stars', 'wpdirectorykit' ),
1121 'type' => \Elementor\Controls_Manager::SWITCHER,
1122 'label_on' => __( 'On', 'wpdirectorykit' ),
1123 'label_off' => __( 'Off', 'wpdirectorykit' ),
1124 'return_value' => 'yes',
1125 'default' => '',
1126 'description' => esc_html__( 'Numeric values required', 'wpdirectorykit' ),
1127 ]
1128 );
1129
1130 $repeater_sublistings_fields->add_control(
1131 'is_link',
1132 [
1133 'label' => __( 'Set field like link', 'wpdirectorykit' ),
1134 'type' => \Elementor\Controls_Manager::SWITCHER,
1135 'label_on' => __( 'On', 'wpdirectorykit' ),
1136 'label_off' => __( 'Off', 'wpdirectorykit' ),
1137 'return_value' => 'yes',
1138 'default' => 'yes',
1139 ]
1140 );
1141
1142 $repeater_sublistings_fields->end_controls_tabs();
1143
1144 $this->add_control(
1145 'related_fields_list',
1146 [
1147 'label' => esc_html__('Fields For Query Similar Listings', 'wpdirectorykit'),
1148 'type' => Controls_Manager::REPEATER,
1149 'fields' => $repeater_sublistings_fields->get_controls(),
1150 'default' => [
1151 [
1152 'field' => '63',
1153 'is_stars' => 'yes',
1154 'is_link' => '',
1155 ],
1156 [
1157 'field' => 'post_title',
1158 'is_link' => 'yes',
1159 ],
1160 [
1161 'field' => '64',
1162 'is_link' => '',
1163 ],
1164 ],
1165 'title_field' => '{{{ field }}}',
1166 ]
1167 );
1168
1169 $this->add_control(
1170 'related_fields_header_hr2',
1171 [
1172 'type' => \Elementor\Controls_Manager::DIVIDER,
1173 ]
1174 );
1175
1176 $this->add_responsive_control(
1177 'related_fields_border',
1178 [
1179 'label' => esc_html__('Line Bottom', 'wpdirectorykit'),
1180 'type' => Controls_Manager::HEADING,
1181 ]
1182 );
1183
1184 $this->add_control(
1185 'related_fields_border_width',
1186 [
1187 'label' => __( 'Speed', 'wpdirectorykit' ),
1188 'type' => \Elementor\Controls_Manager::NUMBER,
1189 'min' => 0,
1190 'max' => 10,
1191 'step' => 1,
1192 'default' => 1,
1193 'selectors' => [
1194 '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part ul > li:not(:last-child)' => 'border-bottom-width: {{SIZE}}{{UNIT}};',
1195 ],
1196 ]
1197 );
1198
1199 $this->add_responsive_control(
1200 'related_fields_border_color',
1201 [
1202 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
1203 'type' => Controls_Manager::COLOR,
1204 'selectors' => [
1205 '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part ul > li:not(:last-child)' => 'border-bottom-color: {{VALUE}};',
1206 ],
1207 ]
1208 );
1209
1210 $this->add_responsive_control(
1211 'related_fields_styles',
1212 [
1213 'label' => esc_html__('Styles', 'wpdirectorykit'),
1214 'type' => Controls_Manager::HEADING,
1215 ]
1216 );
1217
1218 $this->add_control(
1219 'related_fields_header_hr3',
1220 [
1221 'type' => \Elementor\Controls_Manager::DIVIDER,
1222 ]
1223 );
1224
1225 $selectors = array(
1226 'normal' => '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part a, {{WRAPPER}} .wdk-listing-card .wdk-sublistings-part span',
1227 'hover'=>'{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part a%1$s'
1228 );
1229 $this->generate_renders_tabs($selectors, 'related_fields_dynamic', ['color','typo','padding','shadow','transition']);
1230
1231 $this->add_control(
1232 'related_fields_part_styles',
1233 [
1234 'label' => esc_html__('Card Part', 'wpdirectorykit'),
1235 'type' => Controls_Manager::HEADING,
1236 ]
1237 );
1238
1239 $this->add_control(
1240 'related_fields_header_hr4',
1241 [
1242 'type' => \Elementor\Controls_Manager::DIVIDER,
1243 ]
1244 );
1245
1246 $selectors = array(
1247 'normal' => '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part',
1248 );
1249 $this->generate_renders_tabs($selectors, 'related_fields_part_dynamic', ['margin','background','border','border_radius','padding','shadow','transition']);
1250
1251 $this->add_control(
1252 'related_fields_star_styles',
1253 [
1254 'label' => esc_html__('Stars', 'wpdirectorykit'),
1255 'type' => Controls_Manager::HEADING,
1256 ]
1257 );
1258
1259 $this->add_control(
1260 'related_fields_header_hr5',
1261 [
1262 'type' => \Elementor\Controls_Manager::DIVIDER,
1263 ]
1264 );
1265
1266 $selectors = array(
1267 'active' => '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part .stars-lst span i.star-active',
1268 'deactive' => '{{WRAPPER}} .wdk-listing-card .wdk-sublistings-part .stars-lst span i.innactive',
1269 );
1270 $this->generate_renders_tabs($selectors, 'related_fields_star_dynamic', ['margin','padding','font-size', 'color']);
1271
1272 $this->end_controls_section();
1273 }
1274 }
1275
1276 private function generate_controls_layout() {
1277 $this->start_controls_section(
1278 'tab_content',
1279 [
1280 'label' => esc_html__('Basic', 'wpdirectorykit'),
1281 'tab' => 'tab_layout',
1282 ]
1283 );
1284
1285 $this->add_control(
1286 'layout_type',
1287 [
1288 'label' => __( 'Layout Type', 'wpdirectorykit' ),
1289 'type' => \Elementor\Controls_Manager::SELECT,
1290 'default' => 'grid',
1291 'options' => [
1292 'grid' => __( 'Grid', 'wpdirectorykit' ),
1293 'list' => __( 'List', 'wpdirectorykit' ),
1294 'carousel' => __( 'Carousel', 'wpdirectorykit' ),
1295 ],
1296 ]
1297 );
1298
1299
1300 $this->add_control(
1301 'enable_separed_styles',
1302 [
1303 'label' => __( 'Different styles for grid/list', 'wpdirectorykit' ),
1304 'type' => \Elementor\Controls_Manager::SWITCHER,
1305 'label_on' => __( 'On', 'wpdirectorykit' ),
1306 'label_off' => __( 'Off', 'wpdirectorykit' ),
1307 'return_value' => 'true',
1308 'default' => '',
1309 'conditions' => [
1310 'relation' => 'or',
1311 'terms' => [
1312 [
1313 'name' => 'layout_type',
1314 'operator' => '==',
1315 'value' => 'grid',
1316 ],
1317 [
1318 'name' => 'layout_type',
1319 'operator' => '==',
1320 'value' => 'list',
1321 ]
1322 ],
1323 ],
1324 ]
1325 );
1326
1327 $this->add_responsive_control(
1328 'row_gap_col',
1329 [
1330 'label' => __( 'Columns', 'wpdirectorykit' ),
1331 'type' => Controls_Manager::SELECT,
1332 'options' => [
1333 '' => esc_html__('Default', 'wpdirectorykit'),
1334 'auto' => esc_html__('Auto', 'wpdirectorykit'),
1335 '100%' => '1',
1336 '50%' => '2',
1337 'calc(100% / 3)' => '3',
1338 '25%' => '4',
1339 '20%' => '5',
1340 'auto_flexible' => 'auto flexible',
1341 ],
1342 'selectors_dictionary' => [
1343 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
1344 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
1345 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
1346 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
1347 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
1348 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
1349 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
1350 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
1351 ],
1352 'selectors' => [
1353 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
1354 ],
1355 'default' => 'calc(100% / 3)',
1356 'separator' => 'before',
1357 'conditions' => [
1358 'terms' => [
1359 [
1360 'name' => 'layout_type',
1361 'operator' => '==',
1362 'value' => 'grid',
1363 ]
1364 ],
1365 ],
1366 ]
1367 );
1368
1369 $this->add_responsive_control(
1370 'column_gap',
1371 [
1372 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
1373 'type' => Controls_Manager::SLIDER,
1374 'default' => [
1375 'size' => 10,
1376 ],
1377 'range' => [
1378 'px' => [
1379 'min' => 0,
1380 'max' => 60,
1381 ],
1382 ],
1383 'selectors' => [
1384 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
1385 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
1386 ],
1387 'conditions' => [
1388 'terms' => [
1389 [
1390 'name' => 'layout_type',
1391 'operator' => '==',
1392 'value' => 'grid',
1393 ],
1394 ],
1395 ],
1396 ]
1397 );
1398
1399 $this->add_responsive_control(
1400 'row_gap',
1401 [
1402 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
1403 'type' => Controls_Manager::SLIDER,
1404 'default' => [
1405 'size' => 10,
1406 ],
1407 'range' => [
1408 'px' => [
1409 'min' => 0,
1410 'max' => 60,
1411 ],
1412 ],
1413 'selectors' => [
1414 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1415 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
1416 ],
1417 'conditions' => [
1418 'terms' => [
1419 [
1420 'name' => 'layout_type',
1421 'operator' => '!=',
1422 'value' => 'carousel',
1423 ]
1424 ],
1425 ],
1426 ]
1427 );
1428
1429 $this->add_responsive_control(
1430 'thumbnail_width',
1431 [
1432 'label' => esc_html__('Thumbnail width (For List Version)', 'wpdirectorykit'),
1433 'type' => Controls_Manager::SLIDER,
1434 'default' => [
1435 'size' => 270,
1436 'unit' => 'px',
1437 ],
1438 'size_units' => [ 'px', '%' ],
1439 'range' => [
1440 'px' => [
1441 'min' => 0,
1442 'max' => 600,
1443 ],
1444 '%' => [
1445 'min' => 0,
1446 'max' => 100,
1447 ],
1448 ],
1449 'selectors' => [
1450 '{{WRAPPER}} .wdk-element .wdk-listing-card.list .wdk-thumbnail' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
1451 ],
1452 'conditions' => [
1453 'terms' => [
1454 [
1455 'name' => 'layout_type',
1456 'operator' => '==',
1457 'value' => 'list',
1458 ]
1459 ],
1460 ],
1461 ]
1462 );
1463
1464 /* Carousel Grid Config */
1465 if(true) {
1466 $this->add_responsive_control(
1467 'carousel_column_gap_carousel',
1468 [
1469 'label' => esc_html__('Slider Gap', 'wpdirectorykit'),
1470 'type' => Controls_Manager::SLIDER,
1471 'range' => [
1472 'px' => [
1473 'min' => 0,
1474 'max' => 60,
1475 ],
1476 ],
1477 'selectors' => [
1478 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini ' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
1479 ],
1480 'conditions' => [
1481 'terms' => [
1482 [
1483 'name' => 'layout_type',
1484 'operator' => '==',
1485 'value' => 'carousel',
1486 ]
1487 ],
1488 ],
1489 ]
1490 );
1491
1492 $this->add_responsive_control (
1493 'carousel_column_gap',
1494 [
1495 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
1496 'type' => Controls_Manager::SLIDER,
1497 'default' => [
1498 'size' => 10,
1499 ],
1500 'range' => [
1501 'px' => [
1502 'min' => 0,
1503 'max' => 60,
1504 ],
1505 ],
1506 'selectors' => [
1507 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini .slick-slide > div > .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
1508 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
1509 ],
1510 'conditions' => [
1511 'terms' => [
1512 [
1513 'name' => 'layout_type',
1514 'operator' => '==',
1515 'value' => 'carousel',
1516 ]
1517 ],
1518 ],
1519 ]
1520 );
1521
1522 $this->add_responsive_control(
1523 'carousel_column_gap_top',
1524 [
1525 'label' => esc_html__('Columns Gap Top', 'wpdirectorykit'),
1526 'type' => Controls_Manager::SLIDER,
1527 'default' => [
1528 'size' => 0,
1529 ],
1530 'range' => [
1531 'px' => [
1532 'min' => 0,
1533 'max' => 60,
1534 ],
1535 ],
1536 'selectors' => [
1537 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-top: {{SIZE}}{{UNIT}};',
1538 ],
1539 'conditions' => [
1540 'terms' => [
1541 [
1542 'name' => 'layout_type',
1543 'operator' => '==',
1544 'value' => 'carousel',
1545 ]
1546 ],
1547 ],
1548 ]
1549 );
1550
1551 $this->add_responsive_control(
1552 'carousel_column_gap_bottom',
1553 [
1554 'label' => esc_html__('Columns Gap Bottom', 'wpdirectorykit'),
1555 'type' => Controls_Manager::SLIDER,
1556 'default' => [
1557 'size' => 10,
1558 ],
1559 'range' => [
1560 'px' => [
1561 'min' => 0,
1562 'max' => 60,
1563 ],
1564 ],
1565 'selectors' => [
1566 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-bottom: {{SIZE}}{{UNIT}};',
1567 ],
1568 'conditions' => [
1569 'terms' => [
1570 [
1571 'name' => 'layout_type',
1572 'operator' => '==',
1573 'value' => 'carousel',
1574 ]
1575 ],
1576 ],
1577 ]
1578 );
1579 }
1580
1581 $this->add_control(
1582 'basic_el_header_1',
1583 [
1584 'label' => esc_html__('Text', 'wpdirectorykit'),
1585 'type' => Controls_Manager::HEADING,
1586 'separator' => 'before',
1587 ]
1588 );
1589
1590 $this->add_control(
1591 'content_button_text',
1592 [
1593 'label' => __( 'Button Open Text', 'wpdirectorykit' ),
1594 'type' => \Elementor\Controls_Manager::TEXT,
1595 'default' => '',
1596 ]
1597 );
1598
1599 $this->add_responsive_control(
1600 'thumbn_slider_h',
1601 [
1602 'label' => esc_html__('Thumbnail Slider', 'wpdirectorykit'),
1603 'type' => Controls_Manager::HEADING,
1604 'separator' => 'before',
1605 ]
1606 );
1607
1608 $this->add_responsive_control(
1609 'thumbn_slider_arrow_left',
1610 [
1611 'label' => esc_html__('Icon Left', 'wpdirectorykit'),
1612 'type' => Controls_Manager::ICONS,
1613 'label_block' => true,
1614 ]
1615 );
1616
1617 $this->add_responsive_control(
1618 'thumbn_slider_arrow_right',
1619 [
1620 'label' => esc_html__('Icon Right', 'wpdirectorykit'),
1621 'type' => Controls_Manager::ICONS,
1622 'label_block' => true,
1623 ]
1624 );
1625
1626 $this->end_controls_section();
1627
1628 $this->start_controls_section(
1629 'layout_carousel_sec',
1630 [
1631 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
1632 'tab' => 'tab_layout',
1633 'conditions' => [
1634 'terms' => [
1635 [
1636 'name' => 'layout_type',
1637 'operator' => '==',
1638 'value' => 'carousel',
1639 ]
1640 ],
1641 ],
1642 ]
1643 );
1644
1645 $this->add_control(
1646 'layout_carousel_is_centerMode',
1647 [
1648 'label' => __( 'centerMode', 'wpdirectorykit' ),
1649 'type' => \Elementor\Controls_Manager::SWITCHER,
1650 'label_on' => __( 'On', 'wpdirectorykit' ),
1651 'label_off' => __( 'Off', 'wpdirectorykit' ),
1652 'return_value' => 'true',
1653 'default' => '',
1654 ]
1655 );
1656
1657 $this->add_control(
1658 'layout_carousel_is_infinite',
1659 [
1660 'label' => __( 'Infinite', 'wpdirectorykit' ),
1661 'type' => \Elementor\Controls_Manager::SWITCHER,
1662 'label_on' => __( 'On', 'wpdirectorykit' ),
1663 'label_off' => __( 'Off', 'wpdirectorykit' ),
1664 'return_value' => 'true',
1665 'default' => 'true',
1666 ]
1667 );
1668
1669 $this->add_control(
1670 'layout_carousel_is_autoplay',
1671 [
1672 'label' => __( 'Autoplay', 'wpdirectorykit' ),
1673 'type' => \Elementor\Controls_Manager::SWITCHER,
1674 'label_on' => __( 'On', 'wpdirectorykit' ),
1675 'label_off' => __( 'Off', 'wpdirectorykit' ),
1676 'return_value' => 'true',
1677 'default' => '',
1678 ]
1679 );
1680
1681 $this->add_control(
1682 'layout_carousel_speed',
1683 [
1684 'label' => __( 'Speed', 'wpdirectorykit' ),
1685 'type' => \Elementor\Controls_Manager::NUMBER,
1686 'min' => 0,
1687 'max' => 100000,
1688 'step' => 100,
1689 'default' => 500,
1690 ]
1691 );
1692
1693 $this->add_control(
1694 'layout_carousel_animation_style',
1695 [
1696 'label' => __( 'Animation Style', 'wpdirectorykit' ),
1697 'type' => \Elementor\Controls_Manager::SELECT,
1698 'default' => 'fade',
1699 'options' => [
1700 'slide' => __( 'Slide', 'wpdirectorykit' ),
1701 'fade' => __( 'Fade', 'wpdirectorykit' ),
1702 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
1703 ],
1704 ]
1705 );
1706
1707 $this->add_control(
1708 'layout_carousel_cssease',
1709 [
1710 'label' => __( 'cssEase', 'wpdirectorykit' ),
1711 'type' => \Elementor\Controls_Manager::SELECT,
1712 'default' => 'linear',
1713 'options' => [
1714 'linear' => __( 'linear', 'wpdirectorykit' ),
1715 'ease' => __( 'ease', 'wpdirectorykit' ),
1716 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
1717 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
1718 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
1719 'step-start' => __( 'step-start', 'wpdirectorykit' ),
1720 'step-end' => __( 'step-end', 'wpdirectorykit' ),
1721 ],
1722 ]
1723 );
1724
1725 $this->add_responsive_control(
1726 'layout_carousel_columns',
1727 [
1728 'label' => __( 'Count grid', 'wpdirectorykit' ),
1729 'type' => \Elementor\Controls_Manager::NUMBER,
1730 'min' => 1,
1731 'max' => 10,
1732 'step' => 1,
1733 'default' => 3,
1734 ]
1735 );
1736
1737 $this->end_controls_section();
1738
1739 }
1740
1741 private function generate_controls_styles() {
1742
1743 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
1744 $this->start_controls_section(
1745 'sstyles_thmbn_section',
1746 [
1747 'label' => esc_html__('Section Image', 'wpdirectorykit'),
1748 'tab' => Controls_Manager::TAB_STYLE,
1749 'conditions' => [
1750 'terms' => [
1751 [
1752 'name' => 'is_custom_layout_enable',
1753 'operator' => '!=',
1754 'value' => 'yes',
1755 ]
1756 ],
1757 ],
1758 ]
1759 );
1760 } else {
1761 $this->start_controls_section(
1762 'sstyles_thmbn_section',
1763 [
1764 'label' => esc_html__('Section Image', 'wpdirectorykit'),
1765 'tab' => Controls_Manager::TAB_STYLE,
1766 ]
1767 );
1768
1769 }
1770
1771 $this->add_group_control(
1772 Group_Control_Image_Size::get_type(),
1773 [
1774 'name' => 'thumbnail_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
1775 'default' => 'full',
1776 'separator' => 'none',
1777 ]
1778 );
1779
1780 $this->add_responsive_control(
1781 'styles_thmbn_des_type',
1782 [
1783 'label' => __( 'Design type', 'wpdirectorykit' ),
1784 'type' => \Elementor\Controls_Manager::SELECT,
1785 'default' => 'wdk_size_image_cover',
1786 'options' => [
1787 'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ),
1788 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
1789 ],
1790 ]
1791 );
1792
1793 $this->add_responsive_control(
1794 'styles_thmbn_des_height',
1795 [
1796 'label' => esc_html__('Height Grid View', 'wpdirectorykit'),
1797 'type' => Controls_Manager::SLIDER,
1798 'range' => [
1799 'px' => [
1800 'min' => 50,
1801 'max' => 1500,
1802 ],
1803 'vw' => [
1804 'min' => 0,
1805 'max' => 100,
1806 ],
1807 '%' => [
1808 'min' => 0,
1809 'max' => 100,
1810 ],
1811 ],
1812 'size_units' => [ 'px', 'vw','%' ],
1813 'default' => [
1814 'size' => 350,
1815 'unit' => 'px',
1816 ],
1817 'selectors' => [
1818 '{{WRAPPER}} .wdk-listings-results.wdk_size_image_cover .wdk-listing-card:not(.list) .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
1819 ],
1820 'conditions' => [
1821 'relation' => 'or',
1822 'terms' => [
1823 [
1824 'name' => 'styles_thmbn_des_type',
1825 'operator' => '==',
1826 'value' => 'wdk_size_image_cover',
1827 ],
1828 [
1829 'name' => 'styles_thmbn_des_type',
1830 'operator' => '==',
1831 'value' => 'wdk_image_cover',
1832 ]
1833 ],
1834 ]
1835 ]
1836 );
1837
1838 if(false)
1839 $this->add_responsive_control(
1840 'styles_thmbn_des_height_list',
1841 [
1842 'label' => esc_html__('Height List view', 'wpdirectorykit'),
1843 'type' => Controls_Manager::SLIDER,
1844 'range' => [
1845 'px' => [
1846 'min' => 50,
1847 'max' => 1500,
1848 ],
1849 'vw' => [
1850 'min' => 0,
1851 'max' => 100,
1852 ],
1853 ],
1854 'size_units' => [ 'px', 'vw'],
1855 'selectors' => [
1856 '{{WRAPPER}} .wdk-listings-results.wdk_size_image_cover .wdk-listing-card.list .wdk-thumbnail' => 'height: {{SIZE}}{{UNIT}}',
1857 ],
1858 'separator' => 'after',
1859 'conditions' => [
1860 'relation' => 'or',
1861 'terms' => [
1862 [
1863 'name' => 'styles_thmbn_des_type',
1864 'operator' => '==',
1865 'value' => 'wdk_size_image_cover',
1866 ],
1867 [
1868 'name' => 'styles_thmbn_des_type',
1869 'operator' => '==',
1870 'value' => 'wdk_image_cover',
1871 ]
1872 ],
1873 ]
1874 ]
1875 );
1876
1877 $this->end_controls_section();
1878
1879 $this->start_controls_section(
1880 'styles_carousel_arrows_section',
1881 [
1882 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
1883 'tab' => Controls_Manager::TAB_STYLE,
1884 'conditions' => [
1885 'terms' => [
1886 [
1887 'name' => 'layout_type',
1888 'operator' => '==',
1889 'value' => 'carousel',
1890 ]
1891 ],
1892 ],
1893 ]
1894 );
1895
1896 $this->add_responsive_control(
1897 'styles_carousel_arrows_hide',
1898 [
1899 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1900 'type' => Controls_Manager::SWITCHER,
1901 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1902 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1903 'return_value' => 'none',
1904 'default' => '',
1905 'selectors' => [
1906 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
1907 ],
1908 ]
1909 );
1910
1911 $this->add_responsive_control(
1912 'styles_carousel_arrows_position',
1913 [
1914 'label' => __( 'Position', 'wpdirectorykit' ),
1915 'type' => \Elementor\Controls_Manager::SELECT,
1916 'default' => 'wdk_slider_arrows_bottom',
1917 'options' => [
1918 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
1919 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
1920 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
1921 ],
1922 ]
1923 );
1924
1925 $this->add_responsive_control(
1926 'styles_carousel_arrows_align',
1927 [
1928 'label' => __( 'Align', 'wpdirectorykit' ),
1929 'type' => Controls_Manager::CHOOSE,
1930 'options' => [
1931 'left' => [
1932 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1933 'icon' => 'eicon-text-align-left',
1934 ],
1935 'center' => [
1936 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1937 'icon' => 'eicon-text-align-center',
1938 ],
1939 'right' => [
1940 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1941 'icon' => 'eicon-text-align-right',
1942 ],
1943 'justify' => [
1944 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1945 'icon' => 'eicon-text-align-justify',
1946 ],
1947 ],
1948 'render_type' => 'ui',
1949 'selectors_dictionary' => [
1950 'left' => 'justify-content: flex-start;',
1951 'center' => 'justify-content: center;',
1952 'right' => 'justify-content: flex-end;',
1953 'justify' => 'justify-content: space-between;',
1954 ],
1955 'selectors' => [
1956 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};',
1957 ],
1958 'conditions' => [
1959 'terms' => [
1960 [
1961 'name' => 'styles_carousel_arrows_position',
1962 'operator' => '!=',
1963 'value' => 'wdk_slider_arrows_middle',
1964 ]
1965 ],
1966 ],
1967 ]
1968 );
1969
1970 $this->add_responsive_control(
1971 'styles_carousel_arrows_icon_left_h',
1972 [
1973 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
1974 'type' => Controls_Manager::HEADING,
1975 'separator' => 'before',
1976 ]
1977 );
1978
1979 $selectors = array(
1980 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev',
1981 );
1982 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_s_m_left', ['margin','border','border_radius', 'width','height']);
1983
1984
1985 $this->add_responsive_control(
1986 'styles_carousel_arrows_icon_left',
1987 [
1988 'label' => esc_html__('Icon', 'wpdirectorykit'),
1989 'type' => Controls_Manager::ICONS,
1990 'label_block' => true,
1991 'default' => [
1992 'value' => 'fa fa-angle-left',
1993 'library' => 'solid',
1994 ],
1995 ]
1996 );
1997
1998 $this->add_responsive_control(
1999 'styles_carousel_arrows_icon_right_h',
2000 [
2001 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
2002 'type' => Controls_Manager::HEADING,
2003 'separator' => 'before',
2004 ]
2005 );
2006
2007 $selectors = array(
2008 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next',
2009 );
2010 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_s_m_next', ['margin','border','border_radius', 'width','height']);
2011
2012 $this->add_responsive_control(
2013 'styles_carousel_arrows_icon_right',
2014 [
2015 'label' => esc_html__('Icon', 'wpdirectorykit'),
2016 'type' => Controls_Manager::ICONS,
2017 'label_block' => true,
2018 'default' => [
2019 'value' => 'fa fa-angle-right',
2020 'library' => 'solid',
2021 ],
2022 ]
2023 );
2024
2025 $selectors = array(
2026 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
2027 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
2028 );
2029 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['color','background','border','border_radius','padding','shadow','transition','font-size']);
2030
2031 $this->end_controls_section();
2032
2033 $this->start_controls_section(
2034 'styles_carousel_dots_section',
2035 [
2036 'label' => esc_html__('Section Dots', 'wpdirectorykit'),
2037 'tab' => Controls_Manager::TAB_STYLE,
2038 'conditions' => [
2039 'terms' => [
2040 [
2041 'name' => 'layout_type',
2042 'operator' => '==',
2043 'value' => 'carousel',
2044 ]
2045 ],
2046 ],
2047 ]
2048 );
2049
2050 $this->add_responsive_control(
2051 'styles_carousel_dots_hide',
2052 [
2053 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
2054 'type' => Controls_Manager::SWITCHER,
2055 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
2056 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
2057 'return_value' => 'none',
2058 'default' => '',
2059 'selectors' => [
2060 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
2061 ],
2062 ]
2063 );
2064
2065 $this->add_responsive_control(
2066 'styles_carousel_dots_position_style',
2067 [
2068 'label' => __( 'Position Style', 'wpdirectorykit' ),
2069 'type' => \Elementor\Controls_Manager::SELECT,
2070 'default' => 'wdk_slider_dots_out',
2071 'options' => [
2072 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
2073 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
2074 ],
2075 ]
2076 );
2077
2078 $this->add_responsive_control(
2079 'styles_carousel_dots_align',
2080 [
2081 'label' => __( 'Position', 'wpdirectorykit' ),
2082 'type' => Controls_Manager::CHOOSE,
2083 'options' => [
2084 'left' => [
2085 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
2086 'icon' => 'eicon-text-align-left',
2087 ],
2088 'center' => [
2089 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2090 'icon' => 'eicon-text-align-center',
2091 ],
2092 'right' => [
2093 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
2094 'icon' => 'eicon-text-align-right',
2095 ],
2096 'justify' => [
2097 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
2098 'icon' => 'eicon-text-align-justify',
2099 ],
2100 ],
2101 'render_type' => 'ui',
2102 'selectors_dictionary' => [
2103 'left' => 'justify-content: flex-start;',
2104 'center' => 'justify-content: center;',
2105 'right' => 'justify-content: flex-end;',
2106 'justify' => 'justify-content: space-between;',
2107 ],
2108 'selectors' => [
2109 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};',
2110 ],
2111 ]
2112 );
2113
2114 $this->add_responsive_control(
2115 'styles_carousel_dots_icon',
2116 [
2117 'label' => esc_html__('Icon', 'wpdirectorykit'),
2118 'type' => Controls_Manager::ICONS,
2119 'label_block' => true,
2120 'default' => [
2121 'value' => 'fas fa-circle',
2122 'library' => 'solid',
2123 ],
2124 ]
2125 );
2126
2127 $selectors = array(
2128 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot',
2129 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s',
2130 'active'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li.slick-active .wdk_lr_dot'
2131 );
2132
2133 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
2134
2135 $this->end_controls_section();
2136 }
2137
2138 private function generate_controls_content() {
2139
2140 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
2141 $this->start_controls_section(
2142 'content_thumbnail_section',
2143 [
2144 'label' => esc_html__('Colors', 'wpdirectorykit'),
2145 'tab' => '1',
2146 'conditions' => [
2147 'terms' => [
2148 [
2149 'name' => 'is_custom_layout_enable',
2150 'operator' => '!=',
2151 'value' => 'yes',
2152 ]
2153 ],
2154 ],
2155 ]
2156 );
2157 } else {
2158 $this->start_controls_section(
2159 'content_thumbnail_section',
2160 [
2161 'label' => esc_html__('Colors', 'wpdirectorykit'),
2162 'tab' => '1',
2163 ]
2164 );
2165 }
2166
2167 $this->add_control(
2168 'content_thumbnail_section_header',
2169 [
2170 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
2171 'type' => Controls_Manager::HEADING,
2172 ]
2173 );
2174
2175 $this->add_responsive_control(
2176 'content_thumbnail_section_d_background',
2177 [
2178 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
2179 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
2180 'type' => Controls_Manager::COLOR,
2181 'selectors' => [
2182 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
2183 ],
2184 ]
2185 );
2186
2187 $this->add_control(
2188 'content_thumbnail_section_header_f',
2189 [
2190 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
2191 'type' => Controls_Manager::HEADING,
2192 ]
2193 );
2194
2195 $this->add_group_control(
2196 Group_Control_Box_Shadow::get_type(),
2197 [
2198 'name' => 'content_thumbnail_section_d_featured',
2199 'exclude' => [
2200 'field_shadow_position',
2201 ],
2202 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
2203 ]
2204 );
2205
2206 $this->end_controls_section();
2207
2208
2209 $items = [
2210 [
2211 'key'=>'content_card',
2212 'label'=> esc_html__('Card', 'wpdirectorykit'),
2213 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card',
2214 'options'=>'full',
2215 ],
2216 [
2217 'key'=>'content_label',
2218 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
2219 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
2220 'options'=>'full',
2221 ],
2222 [
2223 'key'=>'content_type',
2224 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
2225 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
2226 'is_featured'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
2227 'options'=>'full',
2228 ],
2229 [
2230 'key'=>'content_title',
2231 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
2232 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-title .title',
2233 'options'=>'full',
2234 ],
2235 [
2236 'key'=>'content_description',
2237 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
2238 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-subtitle-part',
2239 'options'=>'full',
2240 ],
2241 [
2242 'key'=>'content_items',
2243 'label'=> esc_html__('Features part', 'wpdirectorykit'),
2244 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-features-part span',
2245 'options'=>'full',
2246 ],
2247 [
2248 'key'=>'wdk-divider',
2249 'label'=> esc_html__('Divider', 'wpdirectorykit'),
2250 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-divider',
2251 'options'=>'full',
2252 ],
2253 [
2254 'key'=>'content_price',
2255 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
2256 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-footer .wdk-price',
2257 'options'=>'full',
2258 ],
2259 [
2260 'key'=>'content_button',
2261 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
2262 'selector'=>'.wdk-element .wdk-listings-results:not(.enable_separed_styles) .wdk-listing-card .wdk-footer .wdk-btn',
2263 'options'=>['margin','align','typo','color','background_group','border','border_radius','padding','shadow','transition'],
2264 ],
2265 ];
2266
2267
2268 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
2269 $this->_generate_options_card($items,[
2270 'terms' => [
2271 [
2272 'name' => 'enable_separed_styles',
2273 'operator' => '!=',
2274 'value' => 'true',
2275 ], [
2276 'name' => 'is_custom_layout_enable',
2277 'operator' => '!=',
2278 'value' => 'yes',
2279 ]
2280 ],
2281 ]);
2282 } else {
2283 $this->_generate_options_card($items,[
2284 'terms' => [
2285 [
2286 'name' => 'enable_separed_styles',
2287 'operator' => '!=',
2288 'value' => 'true',
2289 ]
2290 ],
2291 ]);
2292 }
2293
2294
2295
2296
2297 $items = [
2298 [
2299 'key'=>'content_card_grid',
2300 'label'=> esc_html__('Card (Grid)', 'wpdirectorykit'),
2301 'selector'=>'.wdk-element .wdk-listing-card.grid',
2302 'options'=>'full',
2303 ],
2304 [
2305 'key'=>'content_label_grid',
2306 'label'=> esc_html__('Over Image Top (Grid)', 'wpdirectorykit'),
2307 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-thumbnail .wdk-over-image-top span',
2308 'options'=>'full',
2309 ],
2310 [
2311 'key'=>'content_type_grid',
2312 'label'=> esc_html__('Over Image Bottom (Grid)', 'wpdirectorykit'),
2313 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-thumbnail .wdk-over-image-bottom',
2314 'is_featured'=>'.wdk-element .wdk-listing-card.grid.is_featured .wdk-thumbnail .wdk-over-image-bottom',
2315 'options'=>'full',
2316 ],
2317 [
2318 'key'=>'content_title_grid',
2319 'label'=> esc_html__('Title Part (Grid)', 'wpdirectorykit'),
2320 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-title .title',
2321 'options'=>'full',
2322 ],
2323 [
2324 'key'=>'content_description_grid',
2325 'label'=> esc_html__('Subtitle part (Grid)', 'wpdirectorykit'),
2326 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-subtitle-part',
2327 'options'=>'full',
2328 ],
2329 [
2330 'key'=>'content_items_grid',
2331 'label'=> esc_html__('Features part (Grid)', 'wpdirectorykit'),
2332 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-features-part span',
2333 'options'=>'full',
2334 ],
2335 [
2336 'key'=>'wdk-divider_grid',
2337 'label'=> esc_html__('Divider (Grid)', 'wpdirectorykit'),
2338 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-divider',
2339 'options'=>'full',
2340 ],
2341 [
2342 'key'=>'content_price_grid',
2343 'label'=> esc_html__('Pricing part (Grid)', 'wpdirectorykit'),
2344 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-footer .wdk-price',
2345 'options'=>'full',
2346 ],
2347 [
2348 'key'=>'content_button_grid',
2349 'label'=> esc_html__('Button Open (Grid)', 'wpdirectorykit'),
2350 'selector'=>'.wdk-element .wdk-listing-card.grid .wdk-footer .wdk-btn',
2351 'options'=>['margin','align','typo','color','background_group','border','border_radius','padding','shadow','transition'],
2352 ],
2353 ];
2354
2355 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
2356
2357 $this->_generate_options_card($items,[
2358 'terms' => [
2359 [
2360 'name' => 'enable_separed_styles',
2361 'operator' => '==',
2362 'value' => 'true',
2363 ], [
2364 'name' => 'is_custom_layout_enable',
2365 'operator' => '!=',
2366 'value' => 'yes',
2367 ]
2368 ],
2369 ],'.grid');
2370 } else {
2371
2372 $this->_generate_options_card($items,[
2373 'terms' => [
2374 [
2375 'name' => 'enable_separed_styles',
2376 'operator' => '==',
2377 'value' => 'true',
2378 ]
2379 ],
2380 ],'.grid');
2381 }
2382
2383 $items = [
2384 [
2385 'key'=>'content_card_list',
2386 'label'=> esc_html__('Card (List)', 'wpdirectorykit'),
2387 'selector'=>'.wdk-element .wdk-listing-card.list',
2388 'options'=>'full',
2389 ],
2390 [
2391 'key'=>'content_label_list',
2392 'label'=> esc_html__('Over Image Top (List)', 'wpdirectorykit'),
2393 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-thumbnail .wdk-over-image-top span',
2394 'options'=>'full',
2395 ],
2396 [
2397 'key'=>'content_type_list',
2398 'label'=> esc_html__('Over Image Bottom (List)', 'wpdirectorykit'),
2399 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-thumbnail .wdk-over-image-bottom',
2400 'is_featured'=>'.wdk-element .wdk-listing-card.list.is_featured .wdk-thumbnail .wdk-over-image-bottom',
2401 'options'=>'full',
2402 ],
2403 [
2404 'key'=>'content_title_list',
2405 'label'=> esc_html__('Title Part (List)', 'wpdirectorykit'),
2406 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-title .title',
2407 'options'=>'full',
2408 ],
2409 [
2410 'key'=>'content_description_list',
2411 'label'=> esc_html__('Subtitle part (List)', 'wpdirectorykit'),
2412 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-subtitle-part',
2413 'options'=>'full',
2414 ],
2415 [
2416 'key'=>'content_items_list',
2417 'label'=> esc_html__('Features part (List)', 'wpdirectorykit'),
2418 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-features-part span',
2419 'options'=>'full',
2420 ],
2421 [
2422 'key'=>'wdk-divider_list',
2423 'label'=> esc_html__('Divider (List)', 'wpdirectorykit'),
2424 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-divider',
2425 'options'=>'full',
2426 ],
2427 [
2428 'key'=>'content_price_list',
2429 'label'=> esc_html__('Pricing part (List)', 'wpdirectorykit'),
2430 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-footer .wdk-price',
2431 'options'=>'full',
2432 ],
2433 [
2434 'key'=>'content_button_list',
2435 'label'=> esc_html__('Button Open (List)', 'wpdirectorykit'),
2436 'selector'=>'.wdk-element .wdk-listing-card.list .wdk-footer .wdk-btn',
2437 'options'=>['margin','align','typo','color','background_group','border','border_radius','padding','shadow','transition'],
2438 ],
2439 ];
2440
2441 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){
2442 $this->_generate_options_card($items,[
2443 'terms' => [
2444 [
2445 'name' => 'enable_separed_styles',
2446 'operator' => '==',
2447 'value' => 'true',
2448 ], [
2449 'name' => 'is_custom_layout_enable',
2450 'operator' => '!=',
2451 'value' => 'yes',
2452 ]
2453 ],
2454 ],'.list');
2455 } else {
2456 $this->_generate_options_card($items,[
2457 'terms' => [
2458 [
2459 'name' => 'enable_separed_styles',
2460 'operator' => '==',
2461 'value' => 'true',
2462 ]
2463 ],
2464 ],'.list');
2465 }
2466
2467
2468
2469 $this->start_controls_section(
2470 'pagination_styles',
2471 [
2472 'label' => esc_html__('Pagination Section', 'wpdirectorykit'),
2473 'tab' => '1',
2474 ]
2475 );
2476 $this->add_responsive_control(
2477 'pagination_styles_align',
2478 [
2479 'label' => __( 'Align', 'wpdirectorykit' ),
2480 'type' => Controls_Manager::CHOOSE,
2481 'options' => [
2482 'left' => [
2483 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
2484 'icon' => 'eicon-text-align-left',
2485 ],
2486 'center' => [
2487 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2488 'icon' => 'eicon-text-align-center',
2489 ],
2490 'right' => [
2491 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
2492 'icon' => 'eicon-text-align-right',
2493 ],
2494 ],
2495 'render_type' => 'ui',
2496 'selectors_dictionary' => [
2497 'left' => 'justify-content: flex-start;',
2498 'center' => 'justify-content: center;',
2499 'right' => 'justify-content: flex-end;',
2500 ],
2501 'selectors' => [
2502 '{{WRAPPER}} .wdk-pagination.pagination' => '{{VALUE}};',
2503 ],
2504 ]
2505 );
2506
2507 $selectors = array(
2508 'normal' => '{{WRAPPER}} .wdk-pagination.pagination',
2509 );
2510
2511 $this->generate_renders_tabs($selectors, 'pagination_styles_dynamic', 'block', ['align']);
2512
2513 $this->add_control(
2514 'pagination_styles_head',
2515 [
2516 'label' => esc_html__('Pagination Links', 'wpdirectorykit'),
2517 'type' => Controls_Manager::HEADING,
2518 'separator' => 'before',
2519 ]
2520 );
2521
2522 $selectors = array(
2523 'normal' => '{{WRAPPER}} .wdk-pagination.pagination .nav-links > *',
2524 'hover'=>'{{WRAPPER}} .wdk-pagination.pagination .nav-links > *%1$s',
2525 'active'=>'{{WRAPPER}} .wdk-pagination.pagination .nav-links > *.current'
2526 );
2527 $this->generate_renders_tabs($selectors, 'pagination_styles_items_dynamic', ['margin','typo','color','background','border','border_radius','padding','shadow','transition', 'width','height']);
2528
2529 $this->end_controls_section();
2530
2531 $items = [
2532 /* header filter */
2533 [
2534 'key'=>'filter_section_box',
2535 'label'=> esc_html__('Filter Box', 'wpdirectorykit'),
2536 'selector'=>'.wdk-filter-head',
2537 'options'=> ['margin','background','border','border_radius','padding','shadow'],
2538 ],
2539 [
2540 'key'=>'filter_group_box',
2541 'label'=> esc_html__('Group Box', 'wpdirectorykit'),
2542 'selector'=>'.wdk-filter-head .filter-group',
2543 'options'=>['margin','background','border','border_radius','padding','shadow'],
2544 ],
2545 [
2546 'key'=>'filter_group_box_order_select',
2547 'label'=> esc_html__('Select Order', 'wpdirectorykit'),
2548 'selector'=>'.wdk-filter-head .filter-group .wdk-order',
2549 'options'=>'full',
2550 ],
2551 [
2552 'key'=>'filter_group_box_order',
2553 'label'=> esc_html__('Group Box View Type', 'wpdirectorykit'),
2554 'selector'=>'.wdk-filter-head .filter-group.wmvc-view-type',
2555 'options'=>false,
2556 ],
2557 [
2558 'key'=>'filter_group_box_view',
2559 'label'=> esc_html__('View Type Icons', 'wpdirectorykit'),
2560 'selector'=>'.wdk-filter-head .filter-group.wmvc-view-type a',
2561 'hover_enable' => true,
2562 'options'=>['align','font-size','color','background','border','border_radius','padding','shadow','transition','margin','width','height'],
2563 ],
2564 [
2565 'key'=>'filter_group_box_filter-status',
2566 'label'=> esc_html__('Listings Count', 'wpdirectorykit'),
2567 'selector'=>'.wdk-filter-head .filter-group.filter-status',
2568 'options'=>'text',
2569 ],
2570 ];
2571
2572 $this->start_controls_section(
2573 'filter_section',
2574 [
2575 'label' => esc_html__( 'Filter Header', 'wpdirectorykit' ),
2576 'tab' => '1',
2577 'conditions' => [
2578 'terms' => [
2579 [
2580 'name' => 'get_filters_enable',
2581 'operator' => '==',
2582 'value' => 'yes',
2583 ]
2584 ],
2585 ],
2586 ]
2587 );
2588 foreach ($items as $item) {
2589 $this->add_control(
2590 $item['key'].'_head',
2591 [
2592 'label' => $item['label'],
2593 'type' => Controls_Manager::HEADING,
2594 'separator' => 'before',
2595 ]
2596 );
2597
2598 $this->add_responsive_control(
2599 $item['key'].'_hide',
2600 [
2601 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
2602 'type' => Controls_Manager::SWITCHER,
2603 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
2604 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
2605 'return_value' => 'none',
2606 'default' => '',
2607 'selectors' => [
2608 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
2609 ],
2610 ]
2611 );
2612
2613 if($item['options']){
2614 $selectors = array(
2615 'normal' => '{{WRAPPER}} '.$item['selector']
2616 );
2617 if(isset($item['hover_enable']) && $item['hover_enable'])
2618 $selectors['hover'] = '{{WRAPPER}} '.$item['selector'].'%1$s';
2619
2620
2621 if( $item['key'] == 'filter_group_box_view')
2622 $selectors['active'] = '{{WRAPPER}} '.$item['selector'].'.active';
2623
2624 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
2625 }
2626 /* special for some elements */
2627 if($item['key'] == 'filter_group_box_order') {
2628 $this->add_responsive_control(
2629 $item['key'].'_align',
2630 [
2631 'label' => __( 'Position', 'wpdirectorykit' ),
2632 'type' => Controls_Manager::CHOOSE,
2633 'options' => [
2634 'left' => [
2635 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
2636 'icon' => 'eicon-text-align-left',
2637 ],
2638 'center' => [
2639 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2640 'icon' => 'eicon-text-align-center',
2641 ],
2642 'right' => [
2643 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
2644 'icon' => 'eicon-text-align-right',
2645 ],
2646 'justify' => [
2647 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
2648 'icon' => 'eicon-text-align-justify',
2649 ],
2650 ],
2651 'render_type' => 'ui',
2652 'selectors_dictionary' => [
2653 'left' => 'justify-content: flex-start;',
2654 'center' => 'justify-content: center;',
2655 'right' => 'justify-content: flex-end;',
2656 'justify' => 'justify-content: space-between;',
2657 ],
2658 'selectors' => [
2659 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
2660 ],
2661 ]
2662 );
2663 }
2664 if($item['key'] == 'filter_group_box') {
2665 $this->add_control(
2666 $item['key'].'_icon',
2667 [
2668 'label' => esc_html__('Icon Order', 'wpdirectorykit'),
2669 'type' => Controls_Manager::ICONS,
2670 'label_block' => true,
2671 'default' => [
2672 'value' => 'fa fa-filter',
2673 'library' => 'solid',
2674 ],
2675 ]
2676 );
2677 $selectors = array(
2678 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
2679 );
2680 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
2681 }
2682 /* END special for some elements */
2683 }
2684 $this->end_controls_section();
2685 }
2686
2687 private function _generate_options_card($items, $conditions = NULL, $prefix = ''){
2688
2689 foreach ($items as $item) {
2690 $this->start_controls_section(
2691 $item['key'].'_section',
2692 [
2693 'label' => $item['label'],
2694 'tab' => '1',
2695 'conditions' => $conditions
2696 ]
2697 );
2698 $this->add_responsive_control(
2699 $item['key'].'_hide',
2700 [
2701 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
2702 'type' => Controls_Manager::SWITCHER,
2703 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
2704 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
2705 'return_value' => 'none',
2706 'default' => '',
2707 'selectors' => [
2708 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
2709 ],
2710 ]
2711 );
2712
2713 $this->add_responsive_control(
2714 $item['key'].'_min-height',
2715 [
2716 'label' => esc_html__('Min Height', 'wpdirectorykit'),
2717 'type' => Controls_Manager::SLIDER,
2718 'range' => [
2719 'px' => [
2720 'min' => 10,
2721 'max' => 1500,
2722 ],
2723 'vw' => [
2724 'min' => 0,
2725 'max' => 100,
2726 ],
2727 '%' => [
2728 'min' => 0,
2729 'max' => 100,
2730 ],
2731 ],
2732 'size_units' => [ 'px', 'vw','%' ],
2733 'selectors' => [
2734 '{{WRAPPER}} '.$item['selector'] => 'min-height: {{SIZE}}{{UNIT}}',
2735 ],
2736
2737 ]
2738 );
2739 /* special for some elements */
2740 if (strpos($item['key'], 'content_description') !== FALSE) {
2741
2742 $key_option = $item['key'].'content_description_limit';
2743 if($item['key'] == 'content_description_limit') {
2744 $key_option = 'content_description_limit';
2745 }
2746
2747 $this->add_control(
2748 $key_option,
2749 [
2750 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
2751 'type' => \Elementor\Controls_Manager::NUMBER,
2752 'min' => 1,
2753 'max' => 10,
2754 'step' => 1,
2755 'selectors' => [
2756 '{{WRAPPER}} .wdk-listing-card'.$prefix.' .wdk-subtitle-part .wdk-stroke' => '-webkit-line-clamp: {{VALUE}};',
2757 ],
2758 ]
2759 );
2760 }
2761
2762 if (strpos($item['key'], 'content_title') !== FALSE) {
2763
2764 $key_option = $item['key'].'content_title_limit';
2765 if($item['key'] == 'content_title_limit') {
2766 $key_option = 'content_title_limit';
2767 }
2768
2769 $this->add_control(
2770 $key_option,
2771 [
2772 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
2773 'type' => \Elementor\Controls_Manager::NUMBER,
2774 'min' => 1,
2775 'max' => 10,
2776 'step' => 1,
2777 'selectors' => [
2778 '{{WRAPPER}} .wdk-listing-card'.$prefix.' .wdk-title span' => '-webkit-line-clamp: {{VALUE}};',
2779 ],
2780 ]
2781 );
2782 }
2783
2784 $selectors = array(
2785 'normal' => '{{WRAPPER}} '.$item['selector'],
2786 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
2787 );
2788
2789 if(isset($item['is_featured'])) {
2790 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
2791 }
2792
2793 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
2794
2795
2796
2797 if(strpos($item['key'], 'content_button') !== FALSE) {
2798
2799 if($item['key'] == 'content_button') {
2800 $this->add_control(
2801 $item['key'].'_icon',
2802 [
2803 'label' => esc_html__('Icon', 'wpdirectorykit'),
2804 'type' => Controls_Manager::ICONS,
2805 'label_block' => true,
2806 'default' => [
2807 'value' => 'fa fa-angle-right',
2808 'library' => 'solid',
2809 ],
2810 ]
2811 );
2812 }
2813
2814 $selectors = array(
2815 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
2816 );
2817 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
2818 }
2819
2820 if(strpos($item['key'], 'content_label') !== FALSE) {
2821 $this->add_control(
2822 $item['key'].'_parent_head',
2823 [
2824 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
2825 'type' => Controls_Manager::HEADING,
2826 'separator' => 'before',
2827 ]
2828 );
2829
2830 $selectors = array(
2831 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card'.$prefix.' .wdk-over-image-top',
2832 );
2833 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']);
2834 }
2835
2836 if(strpos($item['key'], 'content_items') !== FALSE) {
2837 $this->add_control(
2838 $item['key'].'_parent_head',
2839 [
2840 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
2841 'type' => Controls_Manager::HEADING,
2842 'separator' => 'before',
2843 ]
2844 );
2845
2846 $selectors = array(
2847 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card'.$prefix.' .wdk-features-part',
2848 );
2849 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
2850 }
2851
2852 if(strpos($item['key'], 'content_label') !== FALSE) {
2853 $this->add_responsive_control(
2854 $item['key'] .'content_label_positions_y',
2855 [
2856 'label' => __( 'Position Y', 'wpdirectorykit' ),
2857 'type' => Controls_Manager::CHOOSE,
2858 'options' => [
2859 'top' => [
2860 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
2861 'icon' => 'eicon-text-align-top',
2862 ],
2863 'center' => [
2864 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2865 'icon' => 'eicon-text-align-center',
2866 ],
2867 'bottom' => [
2868 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
2869 'icon' => 'eicon-text-align-bottom',
2870 ],
2871 ],
2872 'default' => 'left',
2873 'render_type' => 'ui',
2874 'selectors_dictionary' => [
2875 'top' => 'top:0;bottom:initial',
2876 'center' => 'top:50%;transform: translateY(-50%)',
2877 'bottom' => 'top:initial;bottom:0',
2878 ],
2879 'selectors' => [
2880 '{{WRAPPER}} .wdk-listing-card'.$prefix.' .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
2881 ],
2882 ]
2883 );
2884
2885 $this->add_responsive_control(
2886 $item['key'] .'content_label_positions_x',
2887 [
2888 'label' => __( 'Position X', 'wpdirectorykit' ),
2889 'type' => Controls_Manager::CHOOSE,
2890 'options' => [
2891 'left' => [
2892 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
2893 'icon' => 'eicon-text-align-left',
2894 ],
2895 'center' => [
2896 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2897 'icon' => 'eicon-text-align-center',
2898 ],
2899 'right' => [
2900 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
2901 'icon' => 'eicon-text-align-right',
2902 ],
2903 ],
2904 'default' => 'left',
2905 'render_type' => 'ui',
2906 'selectors_dictionary' => [
2907 'left' => 'left:0',
2908 'center' => 'left:50%;transform: translateX(-50%)',
2909 'right' => 'left:initial; right:0',
2910 ],
2911 'selectors' => [
2912 '{{WRAPPER}} .wdk-listing-card'.$prefix.' .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
2913 ],
2914 ]
2915 );
2916 }
2917
2918 if(strpos($item['key'], 'content_type') !== FALSE) {
2919 $this->add_responsive_control(
2920 $item['key'] .'content_label_positions_y',
2921 [
2922 'label' => __( 'Position Y', 'wpdirectorykit' ),
2923 'type' => Controls_Manager::CHOOSE,
2924 'options' => [
2925 'top' => [
2926 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
2927 'icon' => 'eicon-text-align-top',
2928 ],
2929 'center' => [
2930 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2931 'icon' => 'eicon-text-align-center',
2932 ],
2933 'bottom' => [
2934 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
2935 'icon' => 'eicon-text-align-bottom',
2936 ],
2937 ],
2938 'default' => 'left',
2939 'render_type' => 'ui',
2940 'selectors_dictionary' => [
2941 'top' => 'top:0;bottom:initial',
2942 'center' => 'top:50%;transform: translateY(-50%)',
2943 'bottom' => 'top:initial;bottom:0',
2944 ],
2945 'selectors' => [
2946 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
2947 ],
2948 ]
2949 );
2950
2951 $this->add_responsive_control(
2952 $item['key'] .'content_label_positions_x',
2953 [
2954 'label' => __( 'Position X', 'wpdirectorykit' ),
2955 'type' => Controls_Manager::CHOOSE,
2956 'options' => [
2957 'left' => [
2958 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
2959 'icon' => 'eicon-text-align-left',
2960 ],
2961 'center' => [
2962 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
2963 'icon' => 'eicon-text-align-center',
2964 ],
2965 'right' => [
2966 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
2967 'icon' => 'eicon-text-align-right',
2968 ],
2969 'justify' => [
2970 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
2971 'icon' => 'eicon-text-align-justify',
2972 ],
2973 ],
2974 'default' => 'left',
2975 'render_type' => 'ui',
2976 'selectors_dictionary' => [
2977 'top' => 'justify-content: flex-start;',
2978 'center' => 'justify-content: center;',
2979 'bottom' => 'justify-content: flex-end;',
2980 'justify' => 'justify-content: stretch;',
2981 ],
2982 'selectors' => [
2983 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
2984 ],
2985 ]
2986 );
2987 }
2988 $this->end_controls_section();
2989 }
2990
2991 }
2992
2993 public function enqueue_styles_scripts() {
2994 wp_enqueue_style('slick');
2995 wp_enqueue_style('slick-theme');
2996 wp_enqueue_script('slick');
2997
2998 wp_enqueue_style('wdk-notify');
2999 wp_enqueue_script('wdk-notify');
3000
3001
3002 if( wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')) {
3003 wp_enqueue_script( 'wdk-ajax-loading-listings');
3004 }
3005 }
3006
3007 /**
3008 * Get Elementor templates for select options
3009 */
3010 private function get_elementor_templates() {
3011 $templates = [];
3012
3013 $posts = get_posts([
3014 'post_type' => 'elementor_library',
3015 'post_status' => 'publish',
3016 'numberposts' => -1,
3017 'orderby' => 'title',
3018 'order' => 'ASC'
3019 ]);
3020
3021 foreach ($posts as $post) {
3022 $templates[$post->ID] = $post->post_title . ' (ID: ' . $post->ID . ')';
3023 }
3024
3025 return $templates;
3026 }
3027 }
3028