PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
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-listing-map.php

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

972 lines 41.5 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 WdkListingMap 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
44 if ($this->is_edit_mode_load()) {
45 $this->enqueue_styles_scripts();
46 }
47
48 parent::__construct($data, $args);
49 }
50
51 /**
52 * Retrieve the list of categories the widget belongs to.
53 *
54 * Used to determine where to display the widget in the editor.
55 *
56 * Note that currently Elementor supports only one category.
57 * When multiple categories passed, Elementor uses the first one.
58 *
59 * @since 1.1.0
60 *
61 * @access public
62 *
63 * @return array Widget categories.
64 */
65 public function get_categories() {
66 return [ 'wdk-elementor-listing-preview' ];
67 }
68
69 /**
70 * Retrieve the widget name.
71 *
72 * @since 1.1.0
73 *
74 * @access public
75 *
76 * @return string Widget name.
77 */
78 public function get_name() {
79 return 'wdk-listing-map';
80 }
81
82 /**
83 * Retrieve the widget title.
84 *
85 * @since 1.1.0
86 *
87 * @access public
88 *
89 * @return string Widget title.
90 */
91 public function get_title() {
92 return esc_html__('Wdk Listing Map', 'wpdirectorykit');
93 }
94
95 /**
96 * Retrieve the widget icon.
97 *
98 * @since 1.1.0
99 *
100 * @access public
101 *
102 * @return string Widget icon.
103 */
104 public function get_icon() {
105 return 'eicon-google-maps';
106 }
107
108 /**
109 * Register the widget controls.
110 *
111 * Adds different input fields to allow the user to change and customize the widget settings.
112 *
113 * @since 1.1.0
114 *
115 * @access protected
116 */
117 protected function register_controls() {
118 $this->generate_controls_conf();
119 $this->generate_controls_layout();
120 $this->generate_controls_styles();
121 $this->generate_controls_content();
122
123 $this->insert_pro_message('1');
124 parent::register_controls();
125 }
126
127 /**
128 * Render the widget output on the frontend.
129 *
130 * Written in PHP and used to generate the final HTML.
131 *
132 * @since 1.1.0
133 *
134 * @access protected
135 */
136
137 protected function render() {
138 parent::render();
139 global $wdk_listing_id;
140
141 $this->data['id_element'] = $this->get_id();
142 $this->data['settings'] = $this->get_settings();
143
144 /* default from settings */
145 $this->data['lat'] = wdk_get_option('wdk_default_lat', 51.505);
146 $this->data['lng'] = wdk_get_option('wdk_default_lng', -0.09);
147 $this->data['wdk_listing_id'] = $wdk_listing_id;
148
149 if(!Plugin::$instance->editor->is_edit_mode() && !empty($wdk_listing_id)) {
150 $this->data['lat'] = $this->data['lng'] = NULL;
151 if(!empty($this->data['settings']['field_id'])) {
152 if(strpos($this->data['settings']['field_id'],'__') !== FALSE){
153 $this->data['settings']['field_id'] = substr($this->data['settings']['field_id'], strpos($this->data['settings']['field_id'],'__')+2);
154 }
155
156 $gps = wdk_get_gps(wdk_field_value ($this->data['settings']['field_id'], $wdk_listing_id));
157 if($gps) {
158 $this->data['lat'] = $gps['lat'];
159 $this->data['lng'] = $gps['lng'];
160 }
161 } else {
162 $this->data['lat'] = wdk_field_value ('lat', $wdk_listing_id);
163 $this->data['lng'] = wdk_field_value ('lng', $wdk_listing_id);
164 }
165 } else {
166
167 }
168
169 $this->data['is_edit_mode']= false;
170 if(Plugin::$instance->editor->is_edit_mode() || empty($wdk_listing_id)) {
171 $this->data['is_edit_mode']= true;
172 }
173
174 $this->view('wdk-listing-map', $this->data, true);
175 }
176
177 private function generate_controls_conf() {
178 if(true){
179
180 $this->start_controls_section(
181 'conf_custom_map',
182 [
183 'label' => esc_html__('Map', 'wpdirectorykit'),
184 'tab' => '1',
185 ]
186 );
187
188
189 $this->add_control(
190 'enable_router_suggest',
191 [
192 'label' => esc_html__( 'Enable Router Suggestion', 'wpdirectorykit' ),
193 'type' => Controls_Manager::SWITCHER,
194 'none' => esc_html__( 'True', 'wpdirectorykit' ),
195 'block' => esc_html__( 'False', 'wpdirectorykit' ),
196 'render_type' => 'template',
197 'return_value' => 'yes',
198 'default' => '',
199 ]
200 );
201
202 $this->add_control(
203 'text_suggestion_route_placeholder',
204 [
205 'label' => __( 'Suggestion route placeholder', 'wpdirectorykit' ),
206 'type' => \Elementor\Controls_Manager::TEXT,
207 'rows' => 5,
208 'default' => __( 'Type your address', 'wpdirectorykit' ),
209 'conditions' => [
210 'terms' => [
211 [
212 'name' => 'enable_router_suggest',
213 'operator' => '==',
214 'value' => 'yes',
215 ]
216 ],
217 ],
218 ]
219 );
220
221 $this->add_control(
222 'text_suggestion_route',
223 [
224 'label' => __( 'Suggestion route button', 'wpdirectorykit' ),
225 'type' => \Elementor\Controls_Manager::TEXT,
226 'rows' => 5,
227 'default' => __( 'Suggest Route', 'wpdirectorykit' ),
228 'conditions' => [
229 'terms' => [
230 [
231 'name' => 'enable_router_suggest',
232 'operator' => '==',
233 'value' => 'yes',
234 ]
235 ],
236 ],
237 ]
238 );
239
240 $fields_data = wdk_cached_field_get();
241 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
242 $order_i = 0;
243
244 $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
245 $fields_list [(++$order_i).'__idlisting'] = esc_html__('Id listing', 'wpdirectorykit');
246 $fields_list [(++$order_i).'__post_id'] = esc_html__('Post Id', 'wpdirectorykit');
247 $fields_list [(++$order_i).'__counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
248 $fields_list [(++$order_i).'__lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
249 $fields_list [(++$order_i).'__lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
250 $fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit');
251 $fields_list [(++$order_i).'__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
252 $fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit');
253 $fields_list [(++$order_i).'__post_content'] = esc_html__('WP Content', 'wpdirectorykit');
254 $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit');
255 $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit');
256 $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit');
257
258 foreach($fields_data as $field)
259 {
260 if(wmvc_show_data('field_type', $field) == 'SECTION') {
261 $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
262 } else {
263 $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).']';
264 }
265 }
266 $this->add_control(
267 'field_id',
268 [
269 'label' => __( 'Marker position based on field with address (Detected gps by api)', 'wpdirectorykit' ),
270 'type' => \Elementor\Controls_Manager::SELECT2,
271 'default' => '',
272 'options' => $fields_list,
273 'separator' => 'after',
274 ]
275 );
276
277 $this->add_responsive_control(
278 'conf_custom_map_height',
279 [
280 'label' => esc_html__('Height', 'wpdirectorykit'),
281 'type' => Controls_Manager::SLIDER,
282 'range' => [
283 'px' => [
284 'min' => 100,
285 'max' => 1500,
286 ],
287 ],
288 'render_type' => 'template',
289 'default' => [
290 'size' => 350,
291 ],
292 'selectors' => [
293 '{{WRAPPER}} .wdk-element #wdk_map_results' => 'height: {{SIZE}}px !important',
294 ],
295 'separator' => 'after',
296 ]
297 );
298
299 $this->add_control(
300 'conf_custom_map_zoom_index',
301 [
302 'label' => esc_html__('Zoom Index', 'wpdirectorykit'),
303 'description' => esc_html__( 'Only active if auto centering is disabled', 'wpdirectorykit' ),
304 'type' => Controls_Manager::SLIDER,
305 'range' => [
306 'px' => [
307 'min' => 1,
308 'max' => 18,
309 ],
310 ],
311 'render_type' => 'template',
312 'default' => [
313 'size' => 7,
314 ],
315 ]
316 );
317
318 $this->add_responsive_control(
319 'conf_custom_dragging',
320 [
321 'label' => esc_html__( 'Dragging', 'wpdirectorykit' ),
322 'type' => Controls_Manager::SWITCHER,
323 'none' => esc_html__( 'True', 'wpdirectorykit' ),
324 'block' => esc_html__( 'False', 'wpdirectorykit' ),
325 'render_type' => 'template',
326 'return_value' => 'yes',
327 'default' => 'yes',
328 'separator' => 'before',
329 ]
330 );
331
332
333 $this->add_responsive_control(
334 'conf_custom_popup_enable',
335 [
336 'label' => esc_html__( 'Enable Infobox', 'wpdirectorykit' ),
337 'type' => Controls_Manager::SWITCHER,
338 'none' => esc_html__( 'True', 'wpdirectorykit' ),
339 'block' => esc_html__( 'False', 'wpdirectorykit' ),
340 'render_type' => 'template',
341 'return_value' => 'yes',
342 'default' => 'yes',
343 'separator' => 'before',
344 ]
345 );
346
347 $this->add_responsive_control(
348 'puopup_custom_content',
349 [
350 'label' => esc_html__( 'Custom Fields For Infobox', 'wpdirectorykit' ),
351 'type' => Controls_Manager::SWITCHER,
352 'none' => esc_html__( 'True', 'wpdirectorykit' ),
353 'block' => esc_html__( 'False', 'wpdirectorykit' ),
354 'render_type' => 'template',
355 'return_value' => 'yes',
356 'default' => '',
357 'conditions' => [
358 'terms' => [
359 [
360 'name' => 'conf_custom_popup_enable',
361 'operator' => '==',
362 'value' => 'yes',
363 ]
364 ],
365 ]
366 ]
367 );
368
369 $this->add_control(
370 'conf_custom_map_styles_h',
371 [
372 'label' => __( 'Map Styles', 'wpdirectorykit' ),
373 'type' => \Elementor\Controls_Manager::HEADING,
374 'separator' => 'before',
375 ]
376 );
377
378 $this->add_control(
379 'conf_custom_map_style',
380 [
381 'label' => esc_html__('Styles List', 'wpdirectorykit'),
382 'type' => Controls_Manager::SELECT,
383 'options' => [
384 '' => esc_html__('Default', 'wpdirectorykit'),
385 'custom' => esc_html__('Custom', 'wpdirectorykit'),
386 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Light', 'wpdirectorykit'),
387 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png' => esc_html__('Osmde', 'wpdirectorykit'),
388 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png' => esc_html__('Osmde Fr', 'wpdirectorykit'),
389 'https://tile.openstreetmap.de/{z}/{x}/{y}.png' => esc_html__('Osmde De', 'wpdirectorykit'),
390 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' => esc_html__('Mapnik', 'wpdirectorykit'),
391 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png' => esc_html__('OpenTopoMap', 'wpdirectorykit'),
392 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' => esc_html__('WorldImagery', 'wpdirectorykit'),
393 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Carto DarkMatter', 'wpdirectorykit'),
394 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png' => esc_html__('Carto Voyager', 'wpdirectorykit'),
395 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{r}.png' => esc_html__('Maptiler dark (demo)', 'wpdirectorykit'),
396 'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png' => esc_html__('Thunderforest MobileAtlas', 'wpdirectorykit'),
397 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' => esc_html__('Thunderforest OpenCycleMap', 'wpdirectorykit'),
398 'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png' => esc_html__('Thunderforest TransportDark', 'wpdirectorykit'),
399 'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png' => esc_html__('Thunderforest Landscape', 'wpdirectorykit'),
400 'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png' => esc_html__('Thunderforest Outdoors', 'wpdirectorykit'),
401 'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png' => esc_html__('Thunderforest Pioneer', 'wpdirectorykit'),
402 'https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png' => esc_html__('Thunderforest Neighbourhood', 'wpdirectorykit'),
403 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png' => esc_html__('CyclOSM', 'wpdirectorykit'),
404 'https://{s}.tile.jawg.io/jawg-terrain/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Streets', 'wpdirectorykit'),
405 'https://{s}.tile.jawg.io/jawg-streets/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Sunny', 'wpdirectorykit'),
406 'https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Dark', 'wpdirectorykit'),
407 'https://{s}.tile.jawg.io/jawg-light/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Light', 'wpdirectorykit'),
408 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}' => esc_html__('World Top oMap', 'wpdirectorykit'),
409 'google_map' => esc_html__('Google Map Layout', 'wpdirectorykit'),
410 ],
411 'default' => '',
412 ]
413 );
414
415 $this->add_control(
416 'jawg_map_key',
417 [
418 'label' => __( 'Jawg Map API Key', 'wpdirectorykit' ),
419 /* translators: 1: URL. */
420 'description' => wdk_sprintf(__( 'Please follow link and get API key <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://www.jawg.io/en/pricing')
421 /* translators: 1: URL. */
422 .' '.wdk_sprintf(__( 'or check demo maps <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://www.jawg.io/en/maps'),
423 'type' => \Elementor\Controls_Manager::TEXT,
424 'default' => '',
425 'condition' => [
426 'conf_custom_map_style' => [
427 'https://{s}.tile.jawg.io/jawg-terrain/{z}/{x}/{y}{r}.png',
428 'https://{s}.tile.jawg.io/jawg-streets/{z}/{x}/{y}{r}.png',
429 'https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png',
430 'https://{s}.tile.jawg.io/jawg-light/{z}/{x}/{y}{r}.png',
431 ],
432 ],
433 ]
434 );
435
436 $this->add_control(
437 'carto_map_key',
438 [
439 'label' => __( 'Carto Map API Key', 'wpdirectorykit' ),
440 /* translators: 1: URL. */
441 'description' => wdk_sprintf(__( 'Please follow link and get API key <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://carto.com/basemaps/apikey/'),
442 'type' => \Elementor\Controls_Manager::TEXT,
443 'default' => '',
444 'condition' => [
445 'conf_custom_map_style' => [
446 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png',
447 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png',
448 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png',
449 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{r}.png',
450 ],
451 ],
452 ]
453 );
454
455 $this->add_control(
456 'thunderforest_map_key',
457 [
458 'label' => __( 'Thunderforest Map API Key', 'wpdirectorykit' ),
459 /* translators: 1: URL. */
460 'description' => wdk_sprintf(__( 'Please follow link and get API key <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://www.thunderforest.com/pricing/'),
461 'type' => \Elementor\Controls_Manager::TEXT,
462 'default' => '',
463 'condition' => [
464 'conf_custom_map_style' => [
465 'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png',
466 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png',
467 'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png',
468 'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png',
469 'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png',
470 'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png',
471 'https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png',
472 ],
473 ],
474 ]
475 );
476
477 $this->add_control(
478 'google_map_key',
479 [
480 'label' => __( 'Google Map API Key', 'wpdirectorykit' ),
481 /* translators: 1: URL. */
482 'description' => wdk_sprintf(__( 'Please follow link and get API key <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://developers.google.com/maps/documentation/javascript/get-api-key'),
483 'type' => \Elementor\Controls_Manager::TEXT,
484 'default' => '',
485 'condition' => [
486 'conf_custom_map_style' => ['google_map'],
487 ],
488 ]
489 );
490
491 $this->add_control(
492 'google_map_default_type',
493 [
494 'label' => __( 'Default Type', 'wpdirectorykit' ),
495 'type' => \Elementor\Controls_Manager::SELECT,
496 'default' => 'roadmap',
497 'options' => array(
498 'roadmap' => __( 'Roadmap', 'wpdirectorykit' ),
499 'aerial' => __( 'Aerial', 'wpdirectorykit' ),
500 'terrain' => __( 'Terrain', 'wpdirectorykit' ),
501 'hybrid' => __( 'Hybrid', 'wpdirectorykit' ),
502 'satellite' => __( 'Satellite', 'wpdirectorykit' ),
503 'traffic' => __( 'Traffic', 'wpdirectorykit' ),
504 'transit' => __( 'Transit', 'wpdirectorykit' ),
505 ),
506 'condition' => [
507 'conf_custom_map_style' => ['google_map'],
508 ],
509 ]
510 );
511
512 $this->add_control(
513 'conf_custom_map_style_self',
514 [
515 'label' => esc_html__('Link to custom Map Style', 'wpdirectorykit'),
516 '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' ),
517 'type' => Controls_Manager::TEXTAREA,
518 'render_type' => 'template',
519 'conditions' => [
520 'terms' => [
521 [
522 'name' => 'conf_custom_map_style',
523 'operator' => '==',
524 'value' => 'custom',
525 ]
526 ],
527 ]
528 ]
529 );
530
531
532
533 $this->end_controls_section();
534 }
535
536
537 $this->start_controls_section(
538 'tab_conf_main_section',
539 [
540 'label' => esc_html__('Custom Popup Fields', 'wpdirectorykit'),
541 'tab' => '1',
542 'conditions' => [
543 'terms' => [
544 [
545 'name' => 'puopup_custom_content',
546 'operator' => '==',
547 'value' => 'yes',
548 ]
549 ],
550 ]
551 ]
552 );
553
554 $fields_data = wdk_cached_field_get();
555 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
556 $order_i = 0;
557
558 $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
559 $fields_list [(++$order_i).'__idlisting'] = esc_html__('Id listing', 'wpdirectorykit');
560 $fields_list [(++$order_i).'__post_id'] = esc_html__('Post Id', 'wpdirectorykit');
561 $fields_list [(++$order_i).'__counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
562 $fields_list [(++$order_i).'__lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
563 $fields_list [(++$order_i).'__lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
564 $fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit');
565 $fields_list [(++$order_i).'__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
566 $fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit');
567 $fields_list [(++$order_i).'__post_content'] = esc_html__('WP Content', 'wpdirectorykit');
568 $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit');
569 $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit');
570 $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit');
571
572 foreach($fields_data as $field)
573 {
574 if(wmvc_show_data('field_type', $field) == 'SECTION') {
575 $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
576 } else {
577 $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).']';
578 }
579 }
580 $this->add_control(
581 'title_field_id',
582 [
583 'label' => __( 'Title Field', 'wpdirectorykit' ),
584 'type' => \Elementor\Controls_Manager::SELECT2,
585 'default' => '',
586 'options' => $fields_list,
587 ]
588 );
589
590 $this->add_control(
591 'content_field_id',
592 [
593 'label' => __( 'Content Field', 'wpdirectorykit' ),
594 'type' => \Elementor\Controls_Manager::SELECT2,
595 'default' => '',
596 'options' => $fields_list,
597 ]
598 );
599
600 $this->end_controls_section();
601
602 }
603
604 private function generate_controls_layout() {
605
606 /* default marker layout */
607 $this->generate_controls_layout_default();
608 }
609
610 private function generate_controls_styles() {
611 /* marker */
612 $this->start_controls_section(
613 'styles_marker_sec',
614 [
615 'label' => esc_html__('Marker', 'wpdirectorykit'),
616 'tab' => Controls_Manager::TAB_STYLE,
617 ]
618 );
619
620
621 $this->add_control(
622 'styles_marker_h',
623 [
624 'label' => esc_html__('Marker', 'wpdirectorykit'),
625 'type' => Controls_Manager::HEADING,
626 'separator' => 'before',
627 ]
628 );
629
630 $this->start_controls_tabs('marker_button_style');
631
632 $this->start_controls_tab(
633 'marker',
634 [
635 'label' => esc_html__('Normal', 'wpdirectorykit'),
636 ]
637 );
638
639 $this->add_control(
640 'styles_marker_color',
641 [
642 'label' => esc_html__('Marker Border Color', 'wpdirectorykit'),
643 'type' => Controls_Manager::COLOR,
644 'selectors' => [
645 '{{WRAPPER}} .wdk-element .wdk-map .wdk_marker-card::before' => 'background-color: {{VALUE}};',
646 ],
647 ]
648 );
649
650 $this->add_control(
651 'styles_marker_color_bckg',
652 [
653 'label' => esc_html__('Marker Color', 'wpdirectorykit'),
654 'type' => Controls_Manager::COLOR,
655 'selectors' => [
656 '{{WRAPPER}} .wdk-element .wdk_marker-card:after' => 'background-color: {{VALUE}};',
657 ],
658 ]
659 );
660
661 $this->add_control(
662 'styles_marker_color_text',
663 [
664 'label' => esc_html__('Marker Text Color', 'wpdirectorykit'),
665 'type' => Controls_Manager::COLOR,
666 'selectors' => [
667 '{{WRAPPER}} .wdk_face i' => 'color: {{VALUE}};',
668 ],
669 ]
670 );
671
672 $this->add_control(
673 'conf_custom_map_pin_icon',
674 [
675 'label' => esc_html__('Icon', 'wpdirectorykit'),
676 'type' => Controls_Manager::ICONS,
677 'label_block' => true,
678 'default' => [
679 'value' => 'fa fa-home',
680 'library' => 'solid',
681 ],
682 ]
683 );
684
685 $this->add_control(
686 'conf_custom_map_pin',
687 [
688 'label' => esc_html__('Custom Marker Pin Image', 'wpdirectorykit'),
689 'type' => Controls_Manager::MEDIA,
690 ]
691 );
692
693 $this->end_controls_tab();
694
695 $this->start_controls_tab(
696 'marker_hover',
697 [
698 'label' => esc_html__('Hover', 'wpdirectorykit'),
699 ]
700 );
701
702 $this->add_control(
703 'styles_marker_color_hover',
704 [
705 'label' => esc_html__('Marker Border Color', 'wpdirectorykit'),
706 'type' => Controls_Manager::COLOR,
707 'selectors' => [
708 '{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:before' => 'background-color: {{VALUE}};',
709 ],
710 ]
711 );
712
713 $this->add_control(
714 'styles_marker_color_hover_bckg',
715 [
716 'label' => esc_html__('Marker Color', 'wpdirectorykit'),
717 'type' => Controls_Manager::COLOR,
718 'selectors' => [
719 '{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:after' => 'background-color: {{VALUE}};',
720 ],
721 ]
722 );
723
724 $this->add_control(
725 'styles_marker_color_text_hover',
726 [
727 'label' => esc_html__('Marker Text Color', 'wpdirectorykit'),
728 'type' => Controls_Manager::COLOR,
729 'selectors' => [
730 '{{WRAPPER}} .wdk_marker-container:hover .wdk_face.back i, .wdk_marker-container:hover .wdk_face i' => 'color: {{VALUE}};',
731 ],
732 ]
733 );
734
735 $this->add_control(
736 'styles_marker_effect_duration',
737 [
738 'label' => esc_html__('Transition Duration', 'wpdirectorykit'),
739 'type' => Controls_Manager::SLIDER,
740 'render_type' => 'template',
741 'range' => [
742 'px' => [
743 'min' => 0,
744 'max' => 3000,
745 ],
746 ],
747 'selectors' => [
748 '{{WRAPPER}} .wdk_map-marker-container.clicked .wdk_face.front, .wdk_marker-container:hover .wdk_face.front' => 'transition-duration: {{SIZE}}ms',
749 ],
750 ]
751 );
752
753 $this->end_controls_tab();
754
755 $this->end_controls_tabs();
756 $this->end_controls_section();
757
758 $this->start_controls_section(
759 'section_form_suggestion',
760 [
761 'label' => __( 'Form Suggestion Route', 'wpdirectorykit' ),
762 'tab' => Controls_Manager::TAB_STYLE,
763 'conditions' => [
764 'terms' => [
765 [
766 'name' => 'enable_router_suggest',
767 'operator' => '==',
768 'value' => 'yes',
769 ]
770 ],
771 ],
772 ]
773 );
774
775
776 $this->add_responsive_control (
777 'form_suggestion_style_align',
778 [
779 'label' => __( 'Position', 'wpdirectorykit' ),
780 'type' => Controls_Manager::CHOOSE,
781 'options' => [
782 'left' => [
783 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
784 'icon' => 'eicon-text-align-left',
785 ],
786 'center' => [
787 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
788 'icon' => 'eicon-text-align-center',
789 ],
790 'right' => [
791 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
792 'icon' => 'eicon-text-align-right',
793 ],
794 'justify' => [
795 'title' => esc_html__( 'Default', 'wpdirectorykit' ),
796 'icon' => 'eicon-text-align-justify',
797 ] ,
798 ],
799 'render_type' => 'ui',
800 'selectors_dictionary' => [
801 'left' => 'flex-start',
802 'center' => 'center',
803 'right' => 'flex-end',
804 'justify' => 'space-between',
805 ],
806 'selectors' => [
807 '{{WRAPPER}} .route_suggestion' => 'justify-content:{{VALUE}};',
808 ],
809 ]
810 );
811
812 $this->add_responsive_control(
813 'form_suggestion_column_direct',
814 [
815 'label' => __( 'Direction', 'wpdirectorykit' ),
816 'type' => Controls_Manager::SELECT,
817 'options' => [
818 '' => esc_html__('Default', 'wpdirectorykit'),
819 'row' => esc_html__('Row', 'wpdirectorykit'),
820 'row-reverse' => esc_html__('Row reverse', 'wpdirectorykit'),
821 'column' => esc_html__('Column', 'wpdirectorykit'),
822 'column-reverse' => esc_html__('Column reverse', 'wpdirectorykit'),
823 ],
824 'selectors' => [
825 '{{WRAPPER}} .route_suggestion' => 'flex-direction: {{UNIT}}',
826 ],
827 'separator' => 'before',
828 ]
829 );
830
831 $this->add_responsive_control(
832 'form_suggestion_column_gap',
833 [
834 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
835 'type' => Controls_Manager::SLIDER,
836 'default' => [
837 'size' => 10,
838 ],
839 'range' => [
840 'px' => [
841 'min' => 0,
842 'max' => 60,
843 ],
844 ],
845 'selectors' => [
846 '{{WRAPPER}} .route_suggestion > *' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
847 '{{WRAPPER}} .route_suggestion' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
848 ],
849 ]
850 );
851
852 $this->add_responsive_control(
853 'form_suggestion_row_gap',
854 [
855 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
856 'type' => Controls_Manager::SLIDER,
857 'default' => [
858 'size' => 10,
859 ],
860 'range' => [
861 'px' => [
862 'min' => 0,
863 'max' => 60,
864 ],
865 ],
866 'selectors' => [
867 '{{WRAPPER}} .route_suggestion > *' => 'margin-bottom: {{SIZE}}{{UNIT}};',
868 '{{WRAPPER}} .route_suggestion ' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
869 ],
870 ]
871 );
872
873
874 $this->add_responsive_control(
875 'form_suggestion_space_top',
876 [
877 'label' => esc_html__('Space Top', 'wpdirectorykit'),
878 'type' => Controls_Manager::SLIDER,
879 'default' => [
880 'size' => 25,
881 ],
882 'range' => [
883 'px' => [
884 'min' => 0,
885 'max' => 500,
886 ],
887 ],
888 'selectors' => [
889 '{{WRAPPER}} .route_suggestion' => 'margin-top: {{SIZE}}{{UNIT}};',
890 ],
891 ]
892 );
893
894 $this->add_control(
895 'form_suggestion_header_1',
896 [
897 'label' => __( 'Input', 'wpdirectorykit' ),
898 'type' => Controls_Manager::HEADING,
899 ]
900 );
901
902 $selectors = array(
903 'normal' => '{{WRAPPER}} .route_suggestion .input_text',
904 );
905
906 $this->generate_renders_tabs($selectors, 'form_suggestion_input_dynamic', ['typo','color','background','border','border_radius','padding','shadow','transition', 'height', 'width']);
907
908
909 $this->add_control(
910 'form_suggestion_header_2',
911 [
912 'label' => __( 'Placeholder', 'wpdirectorykit' ),
913 'type' => Controls_Manager::HEADING,
914 ]
915 );
916
917 $selectors = array(
918 'normal' => '{{WRAPPER}} .route_suggestion .input_text::placeholder',
919 );
920
921 $this->generate_renders_tabs($selectors, 'form_suggestion_input_pl_dynamic', ['align','typo','color']);
922
923 $this->add_control(
924 'form_suggestion_header_3',
925 [
926 'label' => __( 'Submit Button', 'wpdirectorykit' ),
927 'type' => Controls_Manager::HEADING,
928 ]
929 );
930
931 $selectors = array(
932 'normal' => '{{WRAPPER}} .route_suggestion .wdk-btn',
933 'hover' => '{{WRAPPER}} .route_suggestion .wdk-btn%1$s',
934 );
935
936 $this->generate_renders_tabs($selectors, 'form_suggestion_btn_dynamic', ['typo', 'color', 'border', 'border_radius', 'shadow', 'transition', 'background_group','padding']);
937
938 $this->end_controls_section();
939 }
940
941 private function generate_controls_content() {
942 }
943
944 private function generate_controls_layout_default() {
945
946 }
947
948 private function generate_controls_styles_default() {
949
950 }
951
952 public function enqueue_styles_scripts() {
953 wp_enqueue_style('leaflet');
954 wp_enqueue_style('leaflet-cluster-def');
955 wp_enqueue_style('leaflet-cluster');
956 wp_enqueue_script('leaflet');
957 wp_enqueue_script('leaflet-cluster');
958 wp_enqueue_script('leaflet-fullscreen');
959 wp_enqueue_style('leaflet-fullscreen');
960
961 wp_enqueue_style('wdk-notify');
962 wp_enqueue_script('wdk-notify');
963 wp_enqueue_style( 'wdk-listings-map' );
964
965 wp_enqueue_style('slick');
966 wp_enqueue_style('slick-theme');
967 wp_enqueue_style('wdk-hover');
968 wp_enqueue_script('slick');
969 wp_enqueue_script('leaflet-googlemutant');
970 }
971 }
972