PluginProbe
WP Directory Kit / 1.2.7
WP Directory Kit v1.2.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 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-map.php

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

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