PluginProbe
WP Directory Kit / 1.2.4
WP Directory Kit v1.2.4
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.4, at elementor-elements/classes/wdk-map.php

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