PluginProbe
WP Directory Kit / 1.1.0
WP Directory Kit v1.1.0
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-map.php

wdk-map.php in WP Directory Kit 1.1.0, at elementor-elements/classes/wdk-map.php

1,077 lines 42.0 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 WdkMap 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__('InfoWindow', 'wpdirectorykit')
37 );
38
39 \Elementor\Controls_Manager::add_tab(
40 'tab_content',
41 esc_html__('Main', 'wpdirectorykit')
42 );
43 parent::__construct($data, $args);
44
45 if ($this->is_edit_mode_load()) {
46 wp_enqueue_style('leaflet');
47 wp_enqueue_style('leaflet-cluster-def');
48 wp_enqueue_style('leaflet-cluster');
49 wp_enqueue_script('leaflet');
50 wp_enqueue_script('leaflet-cluster');
51
52 wp_enqueue_style('wdk-notify');
53 wp_enqueue_script('wdk-notify');
54 wp_enqueue_style( 'wdk-listings-map' );
55 $this->enqueue_styles_scripts();
56 }
57 }
58
59 /**
60 * Retrieve the widget name.
61 *
62 * @since 1.1.0
63 *
64 * @access public
65 *
66 * @return string Widget name.
67 */
68 public function get_name() {
69 return 'wdk-map';
70 }
71
72 /**
73 * Retrieve the widget title.
74 *
75 * @since 1.1.0
76 *
77 * @access public
78 *
79 * @return string Widget title.
80 */
81 public function get_title() {
82 return esc_html__('Wdk Map', 'wpdirectorykit');
83 }
84
85 /**
86 * Retrieve the widget icon.
87 *
88 * @since 1.1.0
89 *
90 * @access public
91 *
92 * @return string Widget icon.
93 */
94 public function get_icon() {
95 return 'eicon-google-maps';
96 }
97
98 /**
99 * Register the widget controls.
100 *
101 * Adds different input fields to allow the user to change and customize the widget settings.
102 *
103 * @since 1.1.0
104 *
105 * @access protected
106 */
107 protected function register_controls() {
108 $this->generate_controls_conf();
109 $this->generate_controls_layout();
110 $this->generate_controls_styles();
111 $this->generate_controls_content();
112
113 $this->insert_pro_message('1');
114 parent::register_controls();
115 }
116
117 /**
118 * Render the widget output on the frontend.
119 *
120 * Written in PHP and used to generate the final HTML.
121 *
122 * @since 1.1.0
123 *
124 * @access protected
125 */
126 protected function render() {
127 parent::render();
128
129 /* default from settings */
130 $this->data['lat'] = wdk_get_option('wdk_default_lat', 51.505);
131 $this->data['lng'] = wdk_get_option('wdk_default_lng', -0.09);
132
133 $this->data['id_element'] = $this->get_id();
134 $this->data['settings'] = $this->get_settings();
135 $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by','is_featured', 'address');
136 $controller = 'listing';
137 $custom_parameters = array();
138
139 if(!isset($_GET['order_by'])) {
140 $custom_parameters['order_by'] = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'];
141 }
142
143 if(!isset($_GET['conf_order_by_custom'])) {
144 $custom_parameters['order_by'] = $this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order'];
145 }
146
147 if(!empty($this->data['settings']['conf_query'])) {
148 $qr_string = trim($this->data['settings']['conf_query'],'?');
149 $string_par = array();
150 parse_str($qr_string, $string_par);
151 $custom_parameters += array_map('trim', $string_par);
152 }
153
154 $external_columns = array('location_id', 'category_id', 'post_title');
155 wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
156 $this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['conf_limit'], NULL, array('is_activated' => 1,'is_approved'=>1));
157
158 $this->data['settings']['content_button_icon'] = '';
159
160 $this->data['is_edit_mode']= false;
161 if(Plugin::$instance->editor->is_edit_mode())
162 $this->data['is_edit_mode']= true;
163
164 echo $this->view('wdk-map', $this->data);
165
166 }
167
168 private function generate_controls_conf() {
169 $this->start_controls_section(
170 'tab_conf_main_section',
171 [
172 'label' => esc_html__('Main', 'wpdirectorykit'),
173 'tab' => '1',
174 ]
175 );
176
177 /* conf_results_type :: results_listings */
178 if(true){
179 $this->add_control(
180 'conf_results_type_results_listings_header',
181 [
182 'label' => esc_html__('Results listings', 'wpdirectorykit'),
183 'type' => Controls_Manager::HEADING,
184 'separator' => 'before',
185 ]
186 );
187
188 $this->add_control(
189 'conf_limit',
190 [
191 'label' => __( 'Limit Results', 'wpdirectorykit' ),
192 'type' => \Elementor\Controls_Manager::NUMBER,
193 'min' => 1,
194 'max' => 10000,
195 'step' => 1,
196 'default' => 350,
197 ]
198 );
199
200 $this->add_control(
201 'conf_query',
202 [
203 'label' => __( 'Query', 'wpdirectorykit' ),
204 'type' => \Elementor\Controls_Manager::TEXTAREA,
205 'rows' => 5,
206 'default' => '',
207 'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ),
208 'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url): ', 'wpdirectorykit' ).
209 'field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4'.
210 '</span>',
211 ]
212 );
213
214 $this->add_control(
215 'conf_order_by',
216 [
217 'label' => __('Default Order By Column', 'wpdirectorykit'),
218 'type' => Controls_Manager::SELECT,
219 'label_block' => true,
220 'options' => [
221 'none' => __('None', 'wpdirectorykit'),
222 'post_id' => __('ID', 'wpdirectorykit'),
223 'category_id' => __('Category', 'wpdirectorykit'),
224 ],
225 'default' => 'post_id',
226 ]
227 );
228
229 $this->add_control(
230 'conf_order_by_custom',
231 [
232 'label' => __('Default Custom Order By (Column)', 'wpdirectorykit'),
233 'description' => '<span style="word-break: break-all;">'.__( 'Example: ', 'wpdirectorykit' ).
234 '<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'.
235 '<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'.
236 '<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'.
237 '</span>',
238 'type' => Controls_Manager::TEXT,
239 'label_block' => true,
240 'default' => 'post_id',
241 ]
242 );
243
244 $this->add_control(
245 'conf_order',
246 [
247 'label' => __('Default Listing Order', 'wpdirectorykit'),
248 'type' => Controls_Manager::SELECT,
249 'label_block' => true,
250 'options' => [
251 'asc' => __('Ascending', 'wpdirectorykit'),
252 'desc' => __('Descending', 'wpdirectorykit')
253 ],
254 'default' => 'desc',
255 ]
256 );
257
258 }
259
260 $this->end_controls_section();
261
262 if(true){
263 $this->start_controls_section(
264 'conf_custom_map',
265 [
266 'label' => esc_html__('Map', 'wpdirectorykit'),
267 'tab' => '1',
268 ]
269 );
270
271 $this->add_responsive_control(
272 'conf_custom_map_height',
273 [
274 'label' => esc_html__('Height', 'wpdirectorykit'),
275 'type' => Controls_Manager::SLIDER,
276 'range' => [
277 'px' => [
278 'min' => 100,
279 'max' => 1500,
280 ],
281 ],
282 'render_type' => 'template',
283 'default' => [
284 'size' => 350,
285 ],
286 'selectors' => [
287 '{{WRAPPER}} .wdk-element .wdk_map_results' => 'height: {{SIZE}}px !important',
288 ],
289 'separator' => 'after',
290 ]
291 );
292
293 $this->add_control(
294 'conf_custom_map_zoom_index',
295 [
296 'label' => esc_html__('Zoom Index', 'wpdirectorykit'),
297 'description' => esc_html__( 'Only active if auto centering is disabled', 'wpdirectorykit' ),
298 'type' => Controls_Manager::SLIDER,
299 'range' => [
300 'px' => [
301 'min' => 1,
302 'max' => 18,
303 ],
304 ],
305 'render_type' => 'template',
306 'default' => [
307 'size' => 7,
308 ],
309 'conditions' => [
310 'terms' => [
311 [
312 'name' => 'conf_custom_map_auto_center',
313 'operator' => '!=',
314 'value' => 'yes',
315 ]
316 ],
317 ]
318 ]
319 );
320
321 $this->add_responsive_control(
322 'conf_custom_dragging',
323 [
324 'label' => esc_html__( 'Dragging', 'wpdirectorykit' ),
325 'type' => Controls_Manager::SWITCHER,
326 'none' => esc_html__( 'True', 'wpdirectorykit' ),
327 'block' => esc_html__( 'False', 'wpdirectorykit' ),
328 'render_type' => 'template',
329 'return_value' => 'yes',
330 'default' => 'yes',
331 'separator' => 'before',
332 ]
333 );
334
335
336 $this->add_control(
337 'conf_custom_map_styles_h',
338 [
339 'label' => __( 'Map Styles', 'wpdirectorykit' ),
340 'type' => \Elementor\Controls_Manager::HEADING,
341 'separator' => 'before',
342 ]
343 );
344
345 $this->add_control(
346 'conf_custom_map_style',
347 [
348 'label' => esc_html__('Styles List', 'wpdirectorykit'),
349 'type' => Controls_Manager::SELECT,
350 'options' => [
351 '' => esc_html__('Default', 'wpdirectorykit'),
352 'custom' => esc_html__('Custom', 'wpdirectorykit'),
353 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Light', 'wpdirectorykit'),
354 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png' => esc_html__('Osmde', 'wpdirectorykit'),
355 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png' => esc_html__('OpenTopoMap', 'wpdirectorykit'),
356 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' => esc_html__('OpenCycleMap', 'wpdirectorykit'),
357 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' => esc_html__('WorldImagery', 'wpdirectorykit'),
358 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Carto DarkMatter', 'wpdirectorykit'),
359 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png' => esc_html__('Carto Voyager', 'wpdirectorykit'),
360 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{r}.png' => esc_html__('Maptiler dark (demo)', 'wpdirectorykit'),
361 ],
362 'default' => '',
363 ]
364 );
365
366 $this->add_control(
367 'conf_custom_map_style_self',
368 [
369 'label' => esc_html__('Link to custom Map Style', 'wpdirectorykit'),
370 'description' => esc_html__( 'You can add some custom map by link example https://leaflet-extras.github.io/leaflet-providers/preview/ or create your custom style and put link for example on maps.cloudmade.com/editor', 'wpdirectorykit' ),
371 'type' => Controls_Manager::TEXTAREA,
372 'render_type' => 'template',
373 'conditions' => [
374 'terms' => [
375 [
376 'name' => 'conf_custom_map_style',
377 'operator' => '==',
378 'value' => 'custom',
379 ]
380 ],
381 ]
382 ]
383 );
384
385 $this->end_controls_section();
386 }
387
388 $this->start_controls_section(
389 'conf_map_position',
390 [
391 'label' => esc_html__('Map Positioning', 'wpdirectorykit'),
392 'tab' => '1',
393 ]
394 );
395
396 $this->add_control(
397 'conf_custom_map_center_gps_lat',
398 [
399 'label' => esc_html__('GPS lat Center', 'wpdirectorykit'),
400 'type' => Controls_Manager::TEXT,
401 'default' => '45.675243',
402 ]
403 );
404
405 $this->add_control(
406 'conf_custom_map_center_gps_lng',
407 [
408 'label' => esc_html__('GPS lng Center', 'wpdirectorykit'),
409 'type' => Controls_Manager::TEXT,
410 'default' => '5.907848',
411 ]
412 );
413
414
415 $this->add_responsive_control(
416 'conf_custom_map_auto_center',
417 [
418 'label' => esc_html__( 'Auto Centered By Listings', 'wpdirectorykit' ),
419 'description' => esc_html__( 'Generated center position, based on results, note: z-index and defined center positon will be ignored if exists listings', 'wpdirectorykit' ),
420 'type' => Controls_Manager::SWITCHER,
421 'none' => esc_html__( 'True', 'wpdirectorykit' ),
422 'block' => esc_html__( 'False', 'wpdirectorykit' ),
423 'render_type' => 'template',
424 'return_value' => 'yes',
425 'default' => 'yes',
426 ]
427 );
428
429 $this->end_controls_section();
430
431 }
432
433 private function generate_controls_layout() {
434
435 /* default marker layout */
436 $this->generate_controls_layout_default();
437 }
438
439 private function generate_controls_styles() {
440 /* default marker layout */
441 $this->generate_controls_styles_default();
442
443 /* marker */
444 $this->start_controls_section(
445 'styles_cluster',
446 [
447 'label' => esc_html__('Cluster', 'wpdirectorykit'),
448 'tab' => Controls_Manager::TAB_STYLE,
449 ]
450 );
451
452 $this->add_control(
453 'styles_cluster_color',
454 [
455 'label' => esc_html__('Cluster Color', 'wpdirectorykit'),
456 'type' => Controls_Manager::COLOR,
457 'selectors' => [
458 '{{WRAPPER}} .marker-cluster div' => 'background-color: {{VALUE}};',
459 ],
460 ]
461 );
462
463 $this->add_control(
464 'styles_cluster_color_border',
465 [
466 'label' => esc_html__('Cluster Color Border', 'wpdirectorykit'),
467 'type' => Controls_Manager::COLOR,
468 'selectors' => [
469 '{{WRAPPER}} .marker-cluster div::before' => 'border: 6px solid {{VALUE}}; box-shadow: inset 0 0 0 4px {{VALUE}};',
470 ],
471 ]
472 );
473
474 $this->add_control(
475 'styles_cluster_color_text',
476 [
477 'label' => esc_html__('Cluster Color Text', 'wpdirectorykit'),
478 'type' => Controls_Manager::COLOR,
479 'selectors' => [
480 '{{WRAPPER}} .marker-cluster div' => 'color: {{VALUE}};',
481 ],
482 ]
483 );
484
485 $this->add_group_control(
486 Group_Control_Typography::get_type(),
487 [
488 'name' => 'styles_cluster_color_font',
489 'selector' => '{{WRAPPER}} .marker-cluster div',
490 ]
491 );
492
493 $this->end_controls_section();
494
495 /* marker */
496 $this->start_controls_section(
497 'styles_marker_sec',
498 [
499 'label' => esc_html__('Marker', 'wpdirectorykit'),
500 'tab' => Controls_Manager::TAB_STYLE,
501 ]
502 );
503
504
505 $this->add_control(
506 'styles_marker_h',
507 [
508 'label' => esc_html__('Marker', 'wpdirectorykit'),
509 'type' => Controls_Manager::HEADING,
510 'separator' => 'before',
511 ]
512 );
513
514 $this->start_controls_tabs('marker_button_style');
515
516 $this->start_controls_tab(
517 'marker',
518 [
519 'label' => esc_html__('Normal', 'wpdirectorykit'),
520 ]
521 );
522
523 $this->add_control(
524 'styles_marker_color',
525 [
526 'label' => esc_html__('Marker Border Color', 'wpdirectorykit'),
527 'type' => Controls_Manager::COLOR,
528 'selectors' => [
529 '{{WRAPPER}} .wdk-element .wdk-map .wdk_marker-card::before' => 'background-color: {{VALUE}};',
530 ],
531 ]
532 );
533
534 $this->add_control(
535 'styles_marker_color_bckg',
536 [
537 'label' => esc_html__('Marker Color', 'wpdirectorykit'),
538 'type' => Controls_Manager::COLOR,
539 'selectors' => [
540 '{{WRAPPER}} .wdk-element .wdk_marker-card:after' => 'background-color: {{VALUE}};',
541 ],
542 ]
543 );
544
545 $this->add_control(
546 'styles_marker_color_text',
547 [
548 'label' => esc_html__('Marker Text Color', 'wpdirectorykit'),
549 'type' => Controls_Manager::COLOR,
550 'selectors' => [
551 '{{WRAPPER}} .wdk_face i' => 'color: {{VALUE}};',
552 ],
553 ]
554 );
555
556 $this->add_control(
557 'conf_custom_map_pin_icon',
558 [
559 'label' => esc_html__('Icon', 'wpdirectorykit'),
560 'type' => Controls_Manager::ICONS,
561 'label_block' => true,
562 'default' => [
563 'value' => 'fa fa-home',
564 'library' => 'solid',
565 ],
566 'exclude_inline_options' => array('svg'),
567 ]
568 );
569
570 $this->add_control(
571 'conf_custom_map_pin',
572 [
573 'label' => esc_html__('Custom Marker Pin Image', 'wpdirectorykit'),
574 'type' => Controls_Manager::MEDIA,
575 ]
576 );
577
578 $this->end_controls_tab();
579
580 $this->start_controls_tab(
581 'marker_hover',
582 [
583 'label' => esc_html__('Hover', 'wpdirectorykit'),
584 ]
585 );
586
587 $this->add_control(
588 'styles_marker_color_hover',
589 [
590 'label' => esc_html__('Marker Border Color', 'wpdirectorykit'),
591 'type' => Controls_Manager::COLOR,
592 'selectors' => [
593 '{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:before' => 'background-color: {{VALUE}};',
594 ],
595 ]
596 );
597
598 $this->add_control(
599 'styles_marker_color_hover_bckg',
600 [
601 'label' => esc_html__('Marker Color', 'wpdirectorykit'),
602 'type' => Controls_Manager::COLOR,
603 'selectors' => [
604 '{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:after' => 'background-color: {{VALUE}};',
605 ],
606 ]
607 );
608
609 $this->add_control(
610 'styles_marker_color_text_hover',
611 [
612 'label' => esc_html__('Marker Text Color', 'wpdirectorykit'),
613 'type' => Controls_Manager::COLOR,
614 'selectors' => [
615 '{{WRAPPER}} .wdk_marker-container:hover .wdk_face.back i, .wdk_marker-container:hover .wdk_face i' => 'color: {{VALUE}};',
616 ],
617 ]
618 );
619
620 $this->add_control(
621 'styles_marker_effect_duration',
622 [
623 'label' => esc_html__('Transition Duration', 'wpdirectorykit'),
624 'type' => Controls_Manager::SLIDER,
625 'render_type' => 'template',
626 'range' => [
627 'px' => [
628 'min' => 0,
629 'max' => 3000,
630 ],
631 ],
632 'selectors' => [
633 '{{WRAPPER}} .wdk_map-marker-container.clicked .wdk_face.front, .wdk_marker-container:hover .wdk_face.front' => 'transition-duration: {{SIZE}}ms',
634 ],
635 ]
636 );
637
638 $this->end_controls_tab();
639
640 $this->end_controls_tabs();
641 $this->end_controls_section();
642 }
643
644 private function generate_controls_content() {
645 /* default marker layout */
646 $this->generate_controls_content_default();
647 }
648
649 private function generate_controls_layout_default() {
650
651 }
652
653 private function generate_controls_styles_default() {
654 $this->start_controls_section(
655 'styles_thmbn_section',
656 [
657 'label' => esc_html__('Section Image', 'wpdirectorykit'),
658 'tab' => Controls_Manager::TAB_STYLE,
659 ]
660 );
661
662 $this->add_responsive_control(
663 'styles_thmbn_des_type',
664 [
665 'label' => __( 'Design type ', 'wpdirectorykit' ),
666 'type' => \Elementor\Controls_Manager::SELECT,
667 'default' => 'wdk_size_image_cover',
668 'options' => [
669 '' => __( 'Default Sizes', 'wpdirectorykit' ),
670 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
671 ],
672 ]
673 );
674
675 $this->add_responsive_control(
676 'styles_thmbn_des_height',
677 [
678 'label' => esc_html__('Height', 'wpdirectorykit'),
679 'type' => Controls_Manager::SLIDER,
680 'range' => [
681 'px' => [
682 'min' => 50,
683 'max' => 1500,
684 ],
685 ],
686 'render_type' => 'ui',
687 'default' => [
688 'size' => 350,
689 ],
690 'selectors' => [
691 '{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}px',
692 ],
693 'separator' => 'after',
694 'conditions' => [
695 'relation' => 'or',
696 'terms' => [
697 [
698 'name' => 'styles_thmbn_des_type',
699 'operator' => '==',
700 'value' => 'wdk_size_image_cover',
701 ],
702 [
703 'name' => 'styles_thmbn_des_type',
704 'operator' => '==',
705 'value' => 'wdk_image_cover',
706 ]
707 ],
708 ]
709 ]
710 );
711 $this->end_controls_section();
712 }
713
714 private function generate_controls_content_default() {
715 $this->start_controls_section(
716 'content_thumbnail_section',
717 [
718 'label' => esc_html__('Colors', 'wpdirectorykit'),
719 'tab' => 'tab_layout',
720 ]
721 );
722
723 $this->add_control(
724 'content_thumbnail_section_header',
725 [
726 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
727 'type' => Controls_Manager::HEADING,
728 ]
729 );
730
731 $this->add_responsive_control(
732 'content_thumbnail_section_d_background',
733 [
734 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
735 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
736 'type' => Controls_Manager::COLOR,
737 'selectors' => [
738 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
739 ],
740 ]
741 );
742
743 $this->add_control(
744 'content_thumbnail_section_header_f',
745 [
746 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
747 'type' => Controls_Manager::HEADING,
748 ]
749 );
750
751 $this->add_group_control(
752 Group_Control_Box_Shadow::get_type(),
753 [
754 'name' => 'content_thumbnail_section_d_featured',
755 'exclude' => [
756 'field_shadow_position',
757 ],
758 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
759 ]
760 );
761 $this->end_controls_section();
762
763 $items = [
764 [
765 'key'=>'content_label',
766 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
767 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
768 'options'=>'full',
769 ],
770 [
771 'key'=>'content_type',
772 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
773 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
774 'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
775 'options'=>'full',
776 ],
777 [
778 'key'=>'content_title',
779 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
780 'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title',
781 'options'=>'full',
782 ],
783 [
784 'key'=>'content_description',
785 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
786 'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part',
787 'options'=>'full',
788 ],
789 [
790 'key'=>'content_items',
791 'label'=> esc_html__('Features part', 'wpdirectorykit'),
792 'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span',
793 'options'=>'full',
794 ],
795 [
796 'key'=>'wdk-divider',
797 'label'=> esc_html__('Divider', 'wpdirectorykit'),
798 'selector'=>'.wdk-element .wdk-listing-card .wdk-divider',
799 'options'=>'full',
800 ],
801 [
802 'key'=>'content_price',
803 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
804 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price',
805 'options'=>'full',
806 ],
807 [
808 'key'=>'content_button',
809 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
810 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn',
811 'options'=>'full',
812 ],
813 [
814 'key'=>'content_card',
815 'label'=> esc_html__('Card', 'wpdirectorykit'),
816 'selector'=>'.wdk-element .wdk-listing-card',
817 'options'=>'full',
818 ],
819 ];
820
821 foreach ($items as $item) {
822
823 $this->start_controls_section(
824 $item['key'].'_section',
825 [
826 'label' => $item['label'],
827 'tab' => 'tab_layout'
828 ]
829 );
830 if($item['key']!='content_card')
831 $this->add_responsive_control(
832 $item['key'].'_hide',
833 [
834 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
835 'type' => Controls_Manager::SWITCHER,
836 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
837 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
838 'return_value' => 'none',
839 'default' => '',
840 'selectors' => [
841 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
842 ],
843 ]
844 );
845 $selectors = array(
846 'normal' => '{{WRAPPER}} '.$item['selector'],
847 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
848 );
849
850 if(isset($item['is_featured'])) {
851 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
852 }
853 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
854
855
856
857 /* special for some elements */
858
859 if($item['key'] == 'content_items') {
860 $this->add_control(
861 $item['key'].'_parent_head',
862 [
863 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
864 'type' => Controls_Manager::HEADING,
865 'separator' => 'before',
866 ]
867 );
868
869 $selectors = array(
870 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part',
871 );
872 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
873 }
874
875 if ($item['key'] == 'content_description') {
876
877 $this->add_control(
878 'content_description_limit',
879 [
880 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
881 'type' => \Elementor\Controls_Manager::NUMBER,
882 'min' => 1,
883 'max' => 10,
884 'step' => 1,
885 'default' => 3,
886 'selectors' => [
887 '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};',
888 ],
889 ]
890 );
891
892 }
893
894 if($item['key'] == 'content_button' && FALSE) {
895 $this->add_control(
896 $item['key'].'_icon',
897 [
898 'label' => esc_html__('Icon', 'wpdirectorykit'),
899 'type' => Controls_Manager::ICONS,
900 'label_block' => true,
901 'default' => [
902 'value' => 'fa fa-angle-right',
903 'library' => 'solid',
904 ],
905 ]
906 );
907 $this->add_responsive_control(
908 $item['key'].'_text',
909 [
910 'label' => __( 'Text of Link', 'wpdirectorykit' ),
911 'type' => \Elementor\Controls_Manager::TEXT,
912 'default' => '',
913 ]
914 );
915
916 $selectors = array(
917 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
918 );
919 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
920 }
921
922 if($item['key'] == 'content_label') {
923 $this->add_responsive_control(
924 $item['key'] .'content_label_positions_y',
925 [
926 'label' => __( 'Position Y', 'wpdirectorykit' ),
927 'type' => Controls_Manager::CHOOSE,
928 'options' => [
929 'top' => [
930 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
931 'icon' => 'eicon-text-align-top',
932 ],
933 'center' => [
934 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
935 'icon' => 'eicon-text-align-center',
936 ],
937 'bottom' => [
938 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
939 'icon' => 'eicon-text-align-bottom',
940 ],
941 ],
942 'default' => 'left',
943 'render_type' => 'ui',
944 'selectors_dictionary' => [
945 'top' => 'top:0;bottom:initial',
946 'center' => 'top:50%;transform: translateY(-50%)',
947 'bottom' => 'top:initial;bottom:0',
948 ],
949 'selectors' => [
950 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
951 ],
952 ]
953 );
954
955 $this->add_responsive_control(
956 $item['key'] .'content_label_positions_x',
957 [
958 'label' => __( 'Position X', 'wpdirectorykit' ),
959 'type' => Controls_Manager::CHOOSE,
960 'options' => [
961 'left' => [
962 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
963 'icon' => 'eicon-text-align-left',
964 ],
965 'center' => [
966 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
967 'icon' => 'eicon-text-align-center',
968 ],
969 'right' => [
970 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
971 'icon' => 'eicon-text-align-right',
972 ],
973 ],
974 'default' => 'left',
975 'render_type' => 'ui',
976 'selectors_dictionary' => [
977 'left' => 'left:0',
978 'center' => 'left:50%;transform: translateX(-50%)',
979 'right' => 'left:initial; right:0',
980 ],
981 'selectors' => [
982 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
983 ],
984 ]
985 );
986 }
987
988 if($item['key'] == 'content_type') {
989 $this->add_responsive_control(
990 $item['key'] .'content_label_positions_y',
991 [
992 'label' => __( 'Position Y', 'wpdirectorykit' ),
993 'type' => Controls_Manager::CHOOSE,
994 'options' => [
995 'top' => [
996 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
997 'icon' => 'eicon-text-align-top',
998 ],
999 'center' => [
1000 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1001 'icon' => 'eicon-text-align-center',
1002 ],
1003 'bottom' => [
1004 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1005 'icon' => 'eicon-text-align-bottom',
1006 ],
1007 ],
1008 'default' => 'left',
1009 'render_type' => 'ui',
1010 'selectors_dictionary' => [
1011 'top' => 'top:0;bottom:initial',
1012 'center' => 'top:50%;transform: translateY(-50%)',
1013 'bottom' => 'top:initial;bottom:0',
1014 ],
1015 'selectors' => [
1016 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1017 ],
1018 ]
1019 );
1020
1021 $this->add_responsive_control(
1022 $item['key'] .'content_label_positions_x',
1023 [
1024 'label' => __( 'Position X', 'wpdirectorykit' ),
1025 'type' => Controls_Manager::CHOOSE,
1026 'options' => [
1027 'left' => [
1028 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1029 'icon' => 'eicon-text-align-left',
1030 ],
1031 'center' => [
1032 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1033 'icon' => 'eicon-text-align-center',
1034 ],
1035 'right' => [
1036 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1037 'icon' => 'eicon-text-align-right',
1038 ],
1039 'justify' => [
1040 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1041 'icon' => 'eicon-text-align-justify',
1042 ],
1043 ],
1044 'default' => 'left',
1045 'render_type' => 'ui',
1046 'selectors_dictionary' => [
1047 'top' => 'justify-content: flex-start;',
1048 'center' => 'justify-content: center;',
1049 'bottom' => 'justify-content: flex-end;',
1050 'justify' => 'justify-content: stretch;',
1051 ],
1052 'selectors' => [
1053 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1054 ],
1055 ]
1056 );
1057 }
1058 $this->end_controls_section();
1059 /* END special for some elements */
1060 }
1061 }
1062
1063
1064 public function enqueue_styles_scripts() {
1065 wp_enqueue_style('leaflet');
1066 wp_enqueue_style('leaflet-cluster-def');
1067 wp_enqueue_style('leaflet-cluster');
1068 wp_enqueue_script('leaflet');
1069 wp_enqueue_script('leaflet-cluster');
1070
1071 wp_enqueue_style('wdk-notify');
1072 wp_enqueue_script('wdk-notify');
1073 wp_enqueue_style( 'wdk-listings-map' );
1074 }
1075
1076 }
1077