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

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

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