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-map.php

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

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