PluginProbe
WP Directory Kit / 1.5.4
WP Directory Kit v1.5.4
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.4, at elementor-elements/classes/wdk-listings-results.php

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