| 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($this->data['settings']['enable_custom_gps_center'] == 'yes') { |
| 142 |
$this->data['lat'] = $this->data['settings']['conf_custom_map_center_gps_lat']; |
| 143 |
$this->data['lng'] = $this->data['settings']['conf_custom_map_center_gps_lng']; |
| 144 |
} |
| 145 |
|
| 146 |
if(!isset($_GET['order_by'])) { |
| 147 |
$custom_parameters['order_by'] = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; |
| 148 |
} |
| 149 |
|
| 150 |
if(!isset($_GET['conf_order_by_custom'])) { |
| 151 |
$custom_parameters['order_by'] = $this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order']; |
| 152 |
} |
| 153 |
|
| 154 |
if(!empty($this->data['settings']['conf_query'])) { |
| 155 |
$qr_string = trim($this->data['settings']['conf_query'],'?'); |
| 156 |
$string_par = array(); |
| 157 |
parse_str($qr_string, $string_par); |
| 158 |
$custom_parameters += array_map('trim', $string_par); |
| 159 |
} |
| 160 |
|
| 161 |
$external_columns = array('location_id', 'category_id', 'post_title'); |
| 162 |
wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters); |
| 163 |
$this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['conf_limit'], NULL, array('is_activated' => 1,'is_approved'=>1)); |
| 164 |
|
| 165 |
$this->data['settings']['content_button_icon'] = ''; |
| 166 |
|
| 167 |
$this->data['is_edit_mode']= false; |
| 168 |
if(Plugin::$instance->editor->is_edit_mode()) |
| 169 |
$this->data['is_edit_mode']= true; |
| 170 |
|
| 171 |
echo $this->view('wdk-map', $this->data); |
| 172 |
|
| 173 |
} |
| 174 |
|
| 175 |
private function generate_controls_conf() { |
| 176 |
$this->start_controls_section( |
| 177 |
'tab_conf_main_section', |
| 178 |
[ |
| 179 |
'label' => esc_html__('Main', 'wpdirectorykit'), |
| 180 |
'tab' => '1', |
| 181 |
] |
| 182 |
); |
| 183 |
|
| 184 |
if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')){ |
| 185 |
$this->add_control( |
| 186 |
'is_custom_layout_enable', |
| 187 |
[ |
| 188 |
'label' => __( 'Enable Custom Layout', 'wpdirectorykit' ), |
| 189 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 190 |
'label_on' => __( 'True', 'wpdirectorykit' ), |
| 191 |
'label_off' => __( 'False', 'wpdirectorykit' ), |
| 192 |
'return_value' => 'yes', |
| 193 |
'default' => '', |
| 194 |
|
| 195 |
] |
| 196 |
); |
| 197 |
$this->add_control( |
| 198 |
'custom_layout_id', |
| 199 |
[ |
| 200 |
'label' => __( 'Layout Template id', 'wpdirectorykit' ), |
| 201 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 202 |
'default' => '', |
| 203 |
'placeholder' => __( 'put your template id', 'wpdirectorykit' ), |
| 204 |
'description' => __( 'Create layout here', 'wpdirectorykit' ).' '.wdk_sprintf(__('%1$s here %2$s','wpdirectorykit'),'<a target="_blank" href="'.admin_url('edit.php?post_type=elementor_library#add_new').'">','</a>'), |
| 205 |
'conditions' => [ |
| 206 |
'terms' => [ |
| 207 |
[ |
| 208 |
'name' => 'is_custom_layout_enable', |
| 209 |
'operator' => '==', |
| 210 |
'value' => 'yes', |
| 211 |
] |
| 212 |
], |
| 213 |
], |
| 214 |
] |
| 215 |
); |
| 216 |
} |
| 217 |
|
| 218 |
if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')){ |
| 219 |
$this->add_control( |
| 220 |
'is_ajax_enable', |
| 221 |
[ |
| 222 |
'label' => __( 'Enable Reload content with ajax', 'wpdirectorykit' ), |
| 223 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 224 |
'label_on' => __( 'True', 'wpdirectorykit' ), |
| 225 |
'label_off' => __( 'False', 'wpdirectorykit' ), |
| 226 |
'return_value' => 'yes', |
| 227 |
'default' => '', |
| 228 |
|
| 229 |
] |
| 230 |
); |
| 231 |
} |
| 232 |
|
| 233 |
/* conf_results_type :: results_listings */ |
| 234 |
if(true){ |
| 235 |
$this->add_control( |
| 236 |
'conf_results_type_results_listings_header', |
| 237 |
[ |
| 238 |
'label' => esc_html__('Results listings', 'wpdirectorykit'), |
| 239 |
'type' => Controls_Manager::HEADING, |
| 240 |
'separator' => 'before', |
| 241 |
] |
| 242 |
); |
| 243 |
|
| 244 |
$this->add_control( |
| 245 |
'conf_hide_real_location', |
| 246 |
[ |
| 247 |
'label' => esc_html__( 'Hide real location', 'wpdirectorykit' ), |
| 248 |
'type' => Controls_Manager::SWITCHER, |
| 249 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 250 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 251 |
'render_type' => 'template', |
| 252 |
'return_value' => 'yes', |
| 253 |
'default' => '', |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
$this->add_control( |
| 258 |
'enable_rectangle_auto_search', |
| 259 |
[ |
| 260 |
'label' => esc_html__( 'Recangle auto search', 'wpdirectorykit' ), |
| 261 |
'type' => Controls_Manager::SWITCHER, |
| 262 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 263 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 264 |
'render_type' => 'template', |
| 265 |
'return_value' => 'yes', |
| 266 |
'default' => 'yes', |
| 267 |
] |
| 268 |
); |
| 269 |
|
| 270 |
$this->add_control( |
| 271 |
'disable_rectangle', |
| 272 |
[ |
| 273 |
'label' => esc_html__( 'Disable Rectangle Search', 'wpdirectorykit' ), |
| 274 |
'type' => Controls_Manager::SWITCHER, |
| 275 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 276 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 277 |
'render_type' => 'template', |
| 278 |
'return_value' => 'yes', |
| 279 |
'default' => '', |
| 280 |
] |
| 281 |
); |
| 282 |
|
| 283 |
$this->add_control( |
| 284 |
'enable_scrollWheelZoom', |
| 285 |
[ |
| 286 |
'label' => esc_html__( 'Enable scrollWheelZoom', 'wpdirectorykit' ), |
| 287 |
'type' => Controls_Manager::SWITCHER, |
| 288 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 289 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 290 |
'render_type' => 'template', |
| 291 |
'return_value' => 'yes', |
| 292 |
'default' => '', |
| 293 |
'separator' => 'after', |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
$this->add_control( |
| 298 |
'conf_limit', |
| 299 |
[ |
| 300 |
'label' => __( 'Limit Results', 'wpdirectorykit' ), |
| 301 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 302 |
'min' => 1, |
| 303 |
'max' => 10000, |
| 304 |
'step' => 1, |
| 305 |
'default' => 350, |
| 306 |
] |
| 307 |
); |
| 308 |
|
| 309 |
$this->add_control( |
| 310 |
'conf_query', |
| 311 |
[ |
| 312 |
'label' => __( 'Query', 'wpdirectorykit' ), |
| 313 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 314 |
'rows' => 5, |
| 315 |
'default' => '', |
| 316 |
'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ), |
| 317 |
'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url):', 'wpdirectorykit' ). |
| 318 |
' field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4&search_agents_ids=3'. |
| 319 |
'</span>', |
| 320 |
] |
| 321 |
); |
| 322 |
|
| 323 |
$this->add_control( |
| 324 |
'conf_order_by', |
| 325 |
[ |
| 326 |
'label' => __('Default Sort By Column', 'wpdirectorykit'), |
| 327 |
'type' => Controls_Manager::SELECT, |
| 328 |
'label_block' => true, |
| 329 |
'options' => [ |
| 330 |
'none' => __('None', 'wpdirectorykit'), |
| 331 |
'post_id' => __('ID', 'wpdirectorykit'), |
| 332 |
'category_id' => __('Category', 'wpdirectorykit'), |
| 333 |
], |
| 334 |
'default' => 'post_id', |
| 335 |
] |
| 336 |
); |
| 337 |
|
| 338 |
$this->add_control( |
| 339 |
'conf_order_by_custom', |
| 340 |
[ |
| 341 |
'label' => __('Default Custom Sort By (Column)', 'wpdirectorykit'), |
| 342 |
'description' => '<span style="word-break: break-all;">'.__( 'Example:', 'wpdirectorykit' ). |
| 343 |
'<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'. |
| 344 |
'<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'. |
| 345 |
'<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'. |
| 346 |
'<br> category_title - Category Title'. |
| 347 |
'<br> location_title - Location Title'. |
| 348 |
'</span>', |
| 349 |
'type' => Controls_Manager::TEXT, |
| 350 |
'label_block' => true, |
| 351 |
'default' => 'post_id', |
| 352 |
] |
| 353 |
); |
| 354 |
|
| 355 |
$this->add_control( |
| 356 |
'conf_order', |
| 357 |
[ |
| 358 |
'label' => __('Default Listing Order', 'wpdirectorykit'), |
| 359 |
'type' => Controls_Manager::SELECT, |
| 360 |
'label_block' => true, |
| 361 |
'options' => [ |
| 362 |
'asc' => __('Ascending', 'wpdirectorykit'), |
| 363 |
'desc' => __('Descending', 'wpdirectorykit') |
| 364 |
], |
| 365 |
'default' => 'desc', |
| 366 |
] |
| 367 |
); |
| 368 |
|
| 369 |
} |
| 370 |
|
| 371 |
$this->end_controls_section(); |
| 372 |
|
| 373 |
if(true){ |
| 374 |
$this->start_controls_section( |
| 375 |
'conf_custom_map', |
| 376 |
[ |
| 377 |
'label' => esc_html__('Map', 'wpdirectorykit'), |
| 378 |
'tab' => '1', |
| 379 |
] |
| 380 |
); |
| 381 |
|
| 382 |
$this->add_responsive_control( |
| 383 |
'conf_custom_map_height', |
| 384 |
[ |
| 385 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 386 |
'type' => Controls_Manager::SLIDER, |
| 387 |
'range' => [ |
| 388 |
'px' => [ |
| 389 |
'min' => 100, |
| 390 |
'max' => 1500, |
| 391 |
], |
| 392 |
], |
| 393 |
'render_type' => 'template', |
| 394 |
'default' => [ |
| 395 |
'size' => 350, |
| 396 |
], |
| 397 |
'selectors' => [ |
| 398 |
'{{WRAPPER}} .wdk-element .wdk_map_results' => 'height: {{SIZE}}px !important', |
| 399 |
], |
| 400 |
'separator' => 'after', |
| 401 |
] |
| 402 |
); |
| 403 |
|
| 404 |
$this->add_control( |
| 405 |
'conf_custom_map_zoom_index', |
| 406 |
[ |
| 407 |
'label' => esc_html__('Zoom Index', 'wpdirectorykit'), |
| 408 |
'description' => esc_html__( 'Only active if auto centering is disabled', 'wpdirectorykit' ), |
| 409 |
'type' => Controls_Manager::SLIDER, |
| 410 |
'range' => [ |
| 411 |
'px' => [ |
| 412 |
'min' => 1, |
| 413 |
'max' => 18, |
| 414 |
], |
| 415 |
], |
| 416 |
'render_type' => 'template', |
| 417 |
'default' => [ |
| 418 |
'size' => 7, |
| 419 |
] |
| 420 |
] |
| 421 |
); |
| 422 |
|
| 423 |
$this->add_control( |
| 424 |
'conf_custom_dragging', |
| 425 |
[ |
| 426 |
'label' => esc_html__( 'Dragging For Desktop', 'wpdirectorykit' ), |
| 427 |
'type' => Controls_Manager::SWITCHER, |
| 428 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 429 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 430 |
'render_type' => 'template', |
| 431 |
'return_value' => 'yes', |
| 432 |
'default' => 'yes', |
| 433 |
'separator' => 'before', |
| 434 |
] |
| 435 |
); |
| 436 |
|
| 437 |
$this->add_control( |
| 438 |
'conf_custom_dragging_mobile', |
| 439 |
[ |
| 440 |
'label' => esc_html__( 'Dragging For Mobile', 'wpdirectorykit' ), |
| 441 |
'type' => Controls_Manager::SWITCHER, |
| 442 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 443 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 444 |
'render_type' => 'template', |
| 445 |
'return_value' => 'yes', |
| 446 |
'default' => '', |
| 447 |
'separator' => 'before', |
| 448 |
] |
| 449 |
); |
| 450 |
|
| 451 |
$this->add_control( |
| 452 |
'conf_custom_map_styles_h', |
| 453 |
[ |
| 454 |
'label' => __( 'Map Styles', 'wpdirectorykit' ), |
| 455 |
'type' => \Elementor\Controls_Manager::HEADING, |
| 456 |
'separator' => 'before', |
| 457 |
] |
| 458 |
); |
| 459 |
|
| 460 |
$this->add_control( |
| 461 |
'conf_custom_map_style', |
| 462 |
[ |
| 463 |
'label' => esc_html__('Styles List', 'wpdirectorykit'), |
| 464 |
'type' => Controls_Manager::SELECT, |
| 465 |
'options' => [ |
| 466 |
'' => esc_html__('Default', 'wpdirectorykit'), |
| 467 |
'custom' => esc_html__('Custom', 'wpdirectorykit'), |
| 468 |
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Light', 'wpdirectorykit'), |
| 469 |
'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png' => esc_html__('Osmde', 'wpdirectorykit'), |
| 470 |
'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png' => esc_html__('Osmde Fr', 'wpdirectorykit'), |
| 471 |
'https://tile.openstreetmap.de/{z}/{x}/{y}.png' => esc_html__('Osmde De', 'wpdirectorykit'), |
| 472 |
'https://tile.openstreetmap.org/{z}/{x}/{y}.png' => esc_html__('Mapnik', 'wpdirectorykit'), |
| 473 |
'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png' => esc_html__('OpenTopoMap', 'wpdirectorykit'), |
| 474 |
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' => esc_html__('WorldImagery', 'wpdirectorykit'), |
| 475 |
'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png' => esc_html__('Carto DarkMatter', 'wpdirectorykit'), |
| 476 |
'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png' => esc_html__('Carto Voyager', 'wpdirectorykit'), |
| 477 |
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{r}.png' => esc_html__('Maptiler dark (demo)', 'wpdirectorykit'), |
| 478 |
'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png' => esc_html__('Thunderforest MobileAtlas', 'wpdirectorykit'), |
| 479 |
'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' => esc_html__('Thunderforest OpenCycleMap', 'wpdirectorykit'), |
| 480 |
'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png' => esc_html__('Thunderforest TransportDark', 'wpdirectorykit'), |
| 481 |
'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png' => esc_html__('Thunderforest Landscape', 'wpdirectorykit'), |
| 482 |
'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png' => esc_html__('Thunderforest Outdoors', 'wpdirectorykit'), |
| 483 |
'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png' => esc_html__('Thunderforest Pioneer', 'wpdirectorykit'), |
| 484 |
'https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png' => esc_html__('Thunderforest Neighbourhood', 'wpdirectorykit'), |
| 485 |
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png' => esc_html__('CyclOSM', 'wpdirectorykit'), |
| 486 |
'https://{s}.tile.jawg.io/jawg-terrain/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Streets', 'wpdirectorykit'), |
| 487 |
'https://{s}.tile.jawg.io/jawg-streets/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Sunny', 'wpdirectorykit'), |
| 488 |
'https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Dark', 'wpdirectorykit'), |
| 489 |
'https://{s}.tile.jawg.io/jawg-light/{z}/{x}/{y}{r}.png' => esc_html__('Jawg Light', 'wpdirectorykit'), |
| 490 |
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}' => esc_html__('World Top oMap', 'wpdirectorykit'), |
| 491 |
'google_map' => esc_html__('Google Map Layout', 'wpdirectorykit'), |
| 492 |
], |
| 493 |
'default' => '', |
| 494 |
] |
| 495 |
); |
| 496 |
|
| 497 |
$this->add_control( |
| 498 |
'jawg_map_key', |
| 499 |
[ |
| 500 |
'label' => __( 'Jawg Map API Key', 'wpdirectorykit' ), |
| 501 |
'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') |
| 502 |
.' '.wdk_sprintf(__( 'or check demo maps <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://www.jawg.io/en/maps'), |
| 503 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 504 |
'default' => '', |
| 505 |
'condition' => [ |
| 506 |
'conf_custom_map_style' => [ |
| 507 |
'https://{s}.tile.jawg.io/jawg-terrain/{z}/{x}/{y}{r}.png', |
| 508 |
'https://{s}.tile.jawg.io/jawg-streets/{z}/{x}/{y}{r}.png', |
| 509 |
'https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png', |
| 510 |
'https://{s}.tile.jawg.io/jawg-light/{z}/{x}/{y}{r}.png', |
| 511 |
], |
| 512 |
], |
| 513 |
] |
| 514 |
); |
| 515 |
|
| 516 |
$this->add_control( |
| 517 |
'thunderforest_map_key', |
| 518 |
[ |
| 519 |
'label' => __( 'Thunderforest Map API Key', 'wpdirectorykit' ), |
| 520 |
'description' => wdk_sprintf(__( 'Please follow link and get API key <a href="%1$s" target="_blank"> here </a>', 'wpdirectorykit' ), 'https://www.thunderforest.com/pricing/'), |
| 521 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 522 |
'default' => '', |
| 523 |
'condition' => [ |
| 524 |
'conf_custom_map_style' => [ |
| 525 |
'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png', |
| 526 |
'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', |
| 527 |
'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png', |
| 528 |
'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png', |
| 529 |
'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', |
| 530 |
'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png', |
| 531 |
'https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png', |
| 532 |
], |
| 533 |
], |
| 534 |
] |
| 535 |
); |
| 536 |
|
| 537 |
$this->add_control( |
| 538 |
'google_map_key', |
| 539 |
[ |
| 540 |
'label' => __( 'Google Map API Key', 'wpdirectorykit' ), |
| 541 |
'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'), |
| 542 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 543 |
'default' => '', |
| 544 |
'condition' => [ |
| 545 |
'conf_custom_map_style' => ['google_map'], |
| 546 |
], |
| 547 |
] |
| 548 |
); |
| 549 |
|
| 550 |
$this->add_control( |
| 551 |
'google_map_default_type', |
| 552 |
[ |
| 553 |
'label' => __( 'Default Type', 'wpdirectorykit' ), |
| 554 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 555 |
'default' => 'roadmap', |
| 556 |
'options' => array( |
| 557 |
'roadmap' => __( 'Roadmap', 'wpdirectorykit' ), |
| 558 |
'aerial' => __( 'Aerial', 'wpdirectorykit' ), |
| 559 |
'terrain' => __( 'Terrain', 'wpdirectorykit' ), |
| 560 |
'hybrid' => __( 'Hybrid', 'wpdirectorykit' ), |
| 561 |
'satellite' => __( 'Satellite', 'wpdirectorykit' ), |
| 562 |
'traffic' => __( 'Traffic', 'wpdirectorykit' ), |
| 563 |
'transit' => __( 'Transit', 'wpdirectorykit' ), |
| 564 |
), |
| 565 |
'condition' => [ |
| 566 |
'conf_custom_map_style' => ['google_map'], |
| 567 |
], |
| 568 |
] |
| 569 |
); |
| 570 |
|
| 571 |
$this->add_control( |
| 572 |
'conf_custom_map_style_self', |
| 573 |
[ |
| 574 |
'label' => esc_html__('Link to custom Map Style', 'wpdirectorykit'), |
| 575 |
'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' ), |
| 576 |
'type' => Controls_Manager::TEXTAREA, |
| 577 |
'render_type' => 'template', |
| 578 |
'conditions' => [ |
| 579 |
'terms' => [ |
| 580 |
[ |
| 581 |
'name' => 'conf_custom_map_style', |
| 582 |
'operator' => '==', |
| 583 |
'value' => 'custom', |
| 584 |
] |
| 585 |
], |
| 586 |
] |
| 587 |
] |
| 588 |
); |
| 589 |
|
| 590 |
$this->end_controls_section(); |
| 591 |
} |
| 592 |
|
| 593 |
$this->start_controls_section( |
| 594 |
'conf_map_position', |
| 595 |
[ |
| 596 |
'label' => esc_html__('Map Positioning', 'wpdirectorykit'), |
| 597 |
'tab' => '1', |
| 598 |
] |
| 599 |
); |
| 600 |
|
| 601 |
$this->add_control( |
| 602 |
'conf_custom_map_center_gps_lat', |
| 603 |
[ |
| 604 |
'label' => esc_html__('GPS lat Center', 'wpdirectorykit'), |
| 605 |
'type' => Controls_Manager::TEXT, |
| 606 |
'default' => '45.675243', |
| 607 |
] |
| 608 |
); |
| 609 |
|
| 610 |
$this->add_control( |
| 611 |
'conf_custom_map_center_gps_lng', |
| 612 |
[ |
| 613 |
'label' => esc_html__('GPS lng Center', 'wpdirectorykit'), |
| 614 |
'type' => Controls_Manager::TEXT, |
| 615 |
'default' => '5.907848', |
| 616 |
] |
| 617 |
); |
| 618 |
|
| 619 |
|
| 620 |
$this->add_responsive_control( |
| 621 |
'enable_custom_gps_center', |
| 622 |
[ |
| 623 |
'label' => esc_html__( 'Enable custom GPS', 'wpdirectorykit' ), |
| 624 |
'type' => Controls_Manager::SWITCHER, |
| 625 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 626 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 627 |
'render_type' => 'template', |
| 628 |
'return_value' => 'yes', |
| 629 |
'default' => '', |
| 630 |
] |
| 631 |
); |
| 632 |
|
| 633 |
$this->end_controls_section(); |
| 634 |
|
| 635 |
} |
| 636 |
|
| 637 |
private function generate_controls_layout() { |
| 638 |
|
| 639 |
/* default marker layout */ |
| 640 |
$this->generate_controls_layout_default(); |
| 641 |
} |
| 642 |
|
| 643 |
private function generate_controls_styles() { |
| 644 |
/* default marker layout */ |
| 645 |
$this->generate_controls_styles_default(); |
| 646 |
|
| 647 |
/* marker */ |
| 648 |
$this->start_controls_section( |
| 649 |
'styles_cluster', |
| 650 |
[ |
| 651 |
'label' => esc_html__('Cluster', 'wpdirectorykit'), |
| 652 |
'tab' => Controls_Manager::TAB_STYLE, |
| 653 |
] |
| 654 |
); |
| 655 |
|
| 656 |
$this->add_responsive_control( |
| 657 |
'disable_cluster', |
| 658 |
[ |
| 659 |
'label' => esc_html__( 'Disable Clusters', 'wpdirectorykit' ), |
| 660 |
'type' => Controls_Manager::SWITCHER, |
| 661 |
'none' => esc_html__( 'True', 'wpdirectorykit' ), |
| 662 |
'block' => esc_html__( 'False', 'wpdirectorykit' ), |
| 663 |
'render_type' => 'template', |
| 664 |
'return_value' => 'yes', |
| 665 |
'default' => '', |
| 666 |
] |
| 667 |
); |
| 668 |
|
| 669 |
$this->add_control( |
| 670 |
'styles_cluster_color', |
| 671 |
[ |
| 672 |
'label' => esc_html__('Cluster Color', 'wpdirectorykit'), |
| 673 |
'type' => Controls_Manager::COLOR, |
| 674 |
'selectors' => [ |
| 675 |
'{{WRAPPER}} .marker-cluster div' => 'background-color: {{VALUE}};', |
| 676 |
], |
| 677 |
] |
| 678 |
); |
| 679 |
|
| 680 |
$this->add_control( |
| 681 |
'styles_cluster_color_border', |
| 682 |
[ |
| 683 |
'label' => esc_html__('Cluster Color Border', 'wpdirectorykit'), |
| 684 |
'type' => Controls_Manager::COLOR, |
| 685 |
'selectors' => [ |
| 686 |
'{{WRAPPER}} .marker-cluster div::before' => 'border: 6px solid {{VALUE}}; box-shadow: inset 0 0 0 4px {{VALUE}};', |
| 687 |
], |
| 688 |
] |
| 689 |
); |
| 690 |
|
| 691 |
$this->add_control( |
| 692 |
'styles_cluster_color_text', |
| 693 |
[ |
| 694 |
'label' => esc_html__('Cluster Color Text', 'wpdirectorykit'), |
| 695 |
'type' => Controls_Manager::COLOR, |
| 696 |
'selectors' => [ |
| 697 |
'{{WRAPPER}} .marker-cluster div' => 'color: {{VALUE}};', |
| 698 |
], |
| 699 |
] |
| 700 |
); |
| 701 |
|
| 702 |
$this->add_group_control( |
| 703 |
Group_Control_Typography::get_type(), |
| 704 |
[ |
| 705 |
'name' => 'styles_cluster_color_font', |
| 706 |
'selector' => '{{WRAPPER}} .marker-cluster div', |
| 707 |
] |
| 708 |
); |
| 709 |
|
| 710 |
$this->end_controls_section(); |
| 711 |
|
| 712 |
/* marker */ |
| 713 |
$this->start_controls_section( |
| 714 |
'styles_marker_sec', |
| 715 |
[ |
| 716 |
'label' => esc_html__('Marker', 'wpdirectorykit'), |
| 717 |
'tab' => Controls_Manager::TAB_STYLE, |
| 718 |
] |
| 719 |
); |
| 720 |
|
| 721 |
|
| 722 |
$this->add_control( |
| 723 |
'styles_marker_h', |
| 724 |
[ |
| 725 |
'label' => esc_html__('Marker', 'wpdirectorykit'), |
| 726 |
'type' => Controls_Manager::HEADING, |
| 727 |
'separator' => 'before', |
| 728 |
] |
| 729 |
); |
| 730 |
|
| 731 |
$fields_data = wdk_cached_field_get(); |
| 732 |
$fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 733 |
$order_i = 0; |
| 734 |
|
| 735 |
$fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit'); |
| 736 |
$fields_list [(++$order_i).'__first_image'] = esc_html__('First Image', 'wpdirectorykit'); |
| 737 |
$fields_list [(++$order_i).'__counter_views'] = esc_html__('Views counter', 'wpdirectorykit'); |
| 738 |
$fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit'); |
| 739 |
|
| 740 |
$fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit'); |
| 741 |
$fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit'); |
| 742 |
$fields_list [(++$order_i).'__category_title'] = esc_html__('Category', 'wpdirectorykit'); |
| 743 |
$fields_list [(++$order_i).'__location_title'] = esc_html__('Location', 'wpdirectorykit'); |
| 744 |
|
| 745 |
foreach($fields_data as $field) |
| 746 |
{ |
| 747 |
if(wmvc_show_data('field_type', $field) == 'SECTION') { |
| 748 |
$fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --'; |
| 749 |
} else { |
| 750 |
$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).']'; |
| 751 |
} |
| 752 |
} |
| 753 |
|
| 754 |
$this->add_control( |
| 755 |
'custom_marker_fields', |
| 756 |
[ |
| 757 |
'label' => __('Show field value instead of marker on map', 'wpdirectorykit'), |
| 758 |
'type' => \Elementor\Controls_Manager::SELECT2, |
| 759 |
'default' => '', |
| 760 |
'label_block' => true, |
| 761 |
'options' => $fields_list, |
| 762 |
'separator' => 'after', |
| 763 |
] |
| 764 |
); |
| 765 |
|
| 766 |
$this->start_controls_tabs('marker_button_style'); |
| 767 |
|
| 768 |
$this->start_controls_tab( |
| 769 |
'marker', |
| 770 |
[ |
| 771 |
'label' => esc_html__('Normal', 'wpdirectorykit'), |
| 772 |
] |
| 773 |
); |
| 774 |
|
| 775 |
$this->add_control( |
| 776 |
'styles_marker_color', |
| 777 |
[ |
| 778 |
'label' => esc_html__('Marker Border Color', 'wpdirectorykit'), |
| 779 |
'type' => Controls_Manager::COLOR, |
| 780 |
'selectors' => [ |
| 781 |
'{{WRAPPER}} .wdk-element .wdk-map .wdk_marker-card::before' => 'background-color: {{VALUE}};', |
| 782 |
'{{WRAPPER}} .wdk-element .wdk_marker-container.wdk_marker_label' => 'border-color: {{VALUE}};', |
| 783 |
], |
| 784 |
] |
| 785 |
); |
| 786 |
|
| 787 |
$this->add_control( |
| 788 |
'styles_marker_color_bckg', |
| 789 |
[ |
| 790 |
'label' => esc_html__('Marker Color', 'wpdirectorykit'), |
| 791 |
'type' => Controls_Manager::COLOR, |
| 792 |
'selectors' => [ |
| 793 |
'{{WRAPPER}} .wdk-element .wdk_marker-card:after' => 'background-color: {{VALUE}};', |
| 794 |
'{{WRAPPER}} .wdk-element .wdk_marker-container.wdk_marker_label' => 'background-color: {{VALUE}};', |
| 795 |
], |
| 796 |
] |
| 797 |
); |
| 798 |
|
| 799 |
$this->add_control( |
| 800 |
'styles_marker_color_text', |
| 801 |
[ |
| 802 |
'label' => esc_html__('Marker Text Color', 'wpdirectorykit'), |
| 803 |
'type' => Controls_Manager::COLOR, |
| 804 |
'selectors' => [ |
| 805 |
'{{WRAPPER}} .wdk_face i' => 'color: {{VALUE}};', |
| 806 |
'{{WRAPPER}} .wdk_marker-container.wdk_marker_label' => 'color: {{VALUE}};', |
| 807 |
], |
| 808 |
] |
| 809 |
); |
| 810 |
|
| 811 |
$this->add_control( |
| 812 |
'conf_custom_map_pin_icon', |
| 813 |
[ |
| 814 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 815 |
'type' => Controls_Manager::ICONS, |
| 816 |
'label_block' => true, |
| 817 |
'default' => [ |
| 818 |
'value' => 'fa fa-home', |
| 819 |
'library' => 'solid', |
| 820 |
], |
| 821 |
'exclude_inline_options' => array('svg'), |
| 822 |
] |
| 823 |
); |
| 824 |
|
| 825 |
$this->add_control( |
| 826 |
'conf_custom_map_pin', |
| 827 |
[ |
| 828 |
'label' => esc_html__('Custom Marker Pin Image', 'wpdirectorykit'), |
| 829 |
'type' => Controls_Manager::MEDIA, |
| 830 |
] |
| 831 |
); |
| 832 |
|
| 833 |
$this->end_controls_tab(); |
| 834 |
|
| 835 |
$this->start_controls_tab( |
| 836 |
'marker_hover', |
| 837 |
[ |
| 838 |
'label' => esc_html__('Hover', 'wpdirectorykit'), |
| 839 |
] |
| 840 |
); |
| 841 |
|
| 842 |
$this->add_control( |
| 843 |
'styles_marker_color_hover', |
| 844 |
[ |
| 845 |
'label' => esc_html__('Marker Border Color', 'wpdirectorykit'), |
| 846 |
'type' => Controls_Manager::COLOR, |
| 847 |
'selectors' => [ |
| 848 |
'{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:before' => 'background-color: {{VALUE}};', |
| 849 |
'{{WRAPPER}} .wdk-element .wdk_marker-container.wdk_marker_label:hover' => 'border-color: {{VALUE}};', |
| 850 |
], |
| 851 |
] |
| 852 |
); |
| 853 |
|
| 854 |
$this->add_control( |
| 855 |
'styles_marker_color_hover_bckg', |
| 856 |
[ |
| 857 |
'label' => esc_html__('Marker Color', 'wpdirectorykit'), |
| 858 |
'type' => Controls_Manager::COLOR, |
| 859 |
'selectors' => [ |
| 860 |
'{{WRAPPER}} .wdk-element .wdk_marker-container:hover .wdk_marker-card:after' => 'background-color: {{VALUE}};', |
| 861 |
'{{WRAPPER}} .wdk-element .wdk_marker-container.wdk_marker_label:hover' => 'background-color: {{VALUE}};', |
| 862 |
], |
| 863 |
] |
| 864 |
); |
| 865 |
|
| 866 |
$this->add_control( |
| 867 |
'styles_marker_color_text_hover', |
| 868 |
[ |
| 869 |
'label' => esc_html__('Marker Text Color', 'wpdirectorykit'), |
| 870 |
'type' => Controls_Manager::COLOR, |
| 871 |
'selectors' => [ |
| 872 |
'{{WRAPPER}} .wdk_marker-container:hover .wdk_face.back i, .wdk_marker-container:hover .wdk_face i' => 'color: {{VALUE}};', |
| 873 |
'{{WRAPPER}} .wdk_marker-container.wdk_marker_label:hover' => 'color: {{VALUE}};', |
| 874 |
], |
| 875 |
] |
| 876 |
); |
| 877 |
|
| 878 |
$this->add_control( |
| 879 |
'styles_marker_effect_duration', |
| 880 |
[ |
| 881 |
'label' => esc_html__('Transition Duration', 'wpdirectorykit'), |
| 882 |
'type' => Controls_Manager::SLIDER, |
| 883 |
'render_type' => 'template', |
| 884 |
'range' => [ |
| 885 |
'px' => [ |
| 886 |
'min' => 0, |
| 887 |
'max' => 3000, |
| 888 |
], |
| 889 |
], |
| 890 |
'selectors' => [ |
| 891 |
'{{WRAPPER}} .wdk_map-marker-container.clicked .wdk_face.front, .wdk_marker-container:hover .wdk_face.front' => 'transition-duration: {{SIZE}}ms', |
| 892 |
'{{WRAPPER}} .wdk_marker-container.wdk_marker_label' => 'transition-duration: {{SIZE}}ms', |
| 893 |
], |
| 894 |
] |
| 895 |
); |
| 896 |
|
| 897 |
$this->end_controls_tab(); |
| 898 |
|
| 899 |
$this->end_controls_tabs(); |
| 900 |
$this->end_controls_section(); |
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
} |
| 906 |
|
| 907 |
private function generate_controls_content() { |
| 908 |
/* default marker layout */ |
| 909 |
$this->generate_controls_content_default(); |
| 910 |
} |
| 911 |
|
| 912 |
private function generate_controls_layout_default() { |
| 913 |
|
| 914 |
} |
| 915 |
|
| 916 |
private function generate_controls_styles_default() { |
| 917 |
$this->start_controls_section( |
| 918 |
'styles_thmbn_section', |
| 919 |
[ |
| 920 |
'label' => esc_html__('Section Image', 'wpdirectorykit'), |
| 921 |
'tab' => Controls_Manager::TAB_STYLE, |
| 922 |
] |
| 923 |
); |
| 924 |
|
| 925 |
$this->add_responsive_control( |
| 926 |
'styles_thmbn_des_type', |
| 927 |
[ |
| 928 |
'label' => __( 'Design type', 'wpdirectorykit' ), |
| 929 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 930 |
'default' => 'wdk_size_image_cover', |
| 931 |
'options' => [ |
| 932 |
'' => __( 'Default Sizes', 'wpdirectorykit' ), |
| 933 |
'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ), |
| 934 |
], |
| 935 |
] |
| 936 |
); |
| 937 |
|
| 938 |
$this->add_responsive_control( |
| 939 |
'styles_thmbn_des_height', |
| 940 |
[ |
| 941 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 942 |
'type' => Controls_Manager::SLIDER, |
| 943 |
'range' => [ |
| 944 |
'px' => [ |
| 945 |
'min' => 50, |
| 946 |
'max' => 1500, |
| 947 |
], |
| 948 |
], |
| 949 |
'render_type' => 'ui', |
| 950 |
'default' => [ |
| 951 |
'size' => 350, |
| 952 |
], |
| 953 |
'selectors' => [ |
| 954 |
'{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}px', |
| 955 |
], |
| 956 |
'separator' => 'after', |
| 957 |
'conditions' => [ |
| 958 |
'relation' => 'or', |
| 959 |
'terms' => [ |
| 960 |
[ |
| 961 |
'name' => 'styles_thmbn_des_type', |
| 962 |
'operator' => '==', |
| 963 |
'value' => 'wdk_size_image_cover', |
| 964 |
], |
| 965 |
[ |
| 966 |
'name' => 'styles_thmbn_des_type', |
| 967 |
'operator' => '==', |
| 968 |
'value' => 'wdk_image_cover', |
| 969 |
] |
| 970 |
], |
| 971 |
] |
| 972 |
] |
| 973 |
); |
| 974 |
$this->end_controls_section(); |
| 975 |
} |
| 976 |
|
| 977 |
private function generate_controls_content_default() { |
| 978 |
$this->start_controls_section( |
| 979 |
'content_thumbnail_section', |
| 980 |
[ |
| 981 |
'label' => esc_html__('Colors', 'wpdirectorykit'), |
| 982 |
'tab' => 'tab_layout', |
| 983 |
] |
| 984 |
); |
| 985 |
|
| 986 |
$this->add_control( |
| 987 |
'content_thumbnail_section_header', |
| 988 |
[ |
| 989 |
'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'), |
| 990 |
'type' => Controls_Manager::HEADING, |
| 991 |
] |
| 992 |
); |
| 993 |
|
| 994 |
$this->add_responsive_control( |
| 995 |
'content_thumbnail_section_d_background', |
| 996 |
[ |
| 997 |
'label' => esc_html__( 'Color', 'wpdirectorykit' ), |
| 998 |
'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ), |
| 999 |
'type' => Controls_Manager::COLOR, |
| 1000 |
'selectors' => [ |
| 1001 |
'{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};', |
| 1002 |
], |
| 1003 |
] |
| 1004 |
); |
| 1005 |
|
| 1006 |
$this->add_control( |
| 1007 |
'content_thumbnail_section_header_f', |
| 1008 |
[ |
| 1009 |
'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'), |
| 1010 |
'type' => Controls_Manager::HEADING, |
| 1011 |
] |
| 1012 |
); |
| 1013 |
|
| 1014 |
$this->add_group_control( |
| 1015 |
Group_Control_Box_Shadow::get_type(), |
| 1016 |
[ |
| 1017 |
'name' => 'content_thumbnail_section_d_featured', |
| 1018 |
'exclude' => [ |
| 1019 |
'field_shadow_position', |
| 1020 |
], |
| 1021 |
'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured', |
| 1022 |
] |
| 1023 |
); |
| 1024 |
$this->end_controls_section(); |
| 1025 |
|
| 1026 |
$items = [ |
| 1027 |
[ |
| 1028 |
'key'=>'content_label', |
| 1029 |
'label'=> esc_html__('Over Image Top', 'wpdirectorykit'), |
| 1030 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span', |
| 1031 |
'options'=>'full', |
| 1032 |
], |
| 1033 |
[ |
| 1034 |
'key'=>'content_type', |
| 1035 |
'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'), |
| 1036 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom', |
| 1037 |
'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom', |
| 1038 |
'options'=>'full', |
| 1039 |
], |
| 1040 |
[ |
| 1041 |
'key'=>'content_title', |
| 1042 |
'label'=> esc_html__('Title Part', 'wpdirectorykit'), |
| 1043 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title', |
| 1044 |
'options'=>'full', |
| 1045 |
], |
| 1046 |
[ |
| 1047 |
'key'=>'content_description', |
| 1048 |
'label'=> esc_html__('Subtitle part', 'wpdirectorykit'), |
| 1049 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part', |
| 1050 |
'options'=>'full', |
| 1051 |
], |
| 1052 |
[ |
| 1053 |
'key'=>'content_items', |
| 1054 |
'label'=> esc_html__('Features part', 'wpdirectorykit'), |
| 1055 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span', |
| 1056 |
'options'=>'full', |
| 1057 |
], |
| 1058 |
[ |
| 1059 |
'key'=>'wdk-divider', |
| 1060 |
'label'=> esc_html__('Divider', 'wpdirectorykit'), |
| 1061 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-divider', |
| 1062 |
'options'=>'full', |
| 1063 |
], |
| 1064 |
[ |
| 1065 |
'key'=>'content_price', |
| 1066 |
'label'=> esc_html__('Pricing part', 'wpdirectorykit'), |
| 1067 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price', |
| 1068 |
'options'=>'full', |
| 1069 |
], |
| 1070 |
[ |
| 1071 |
'key'=>'content_button', |
| 1072 |
'label'=> esc_html__('Button Open', 'wpdirectorykit'), |
| 1073 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn', |
| 1074 |
'options'=>'full', |
| 1075 |
], |
| 1076 |
[ |
| 1077 |
'key'=>'content_card', |
| 1078 |
'label'=> esc_html__('Card', 'wpdirectorykit'), |
| 1079 |
'selector'=>'.wdk-element .wdk-listing-card', |
| 1080 |
'options'=>'full', |
| 1081 |
], |
| 1082 |
]; |
| 1083 |
|
| 1084 |
foreach ($items as $item) { |
| 1085 |
|
| 1086 |
$this->start_controls_section( |
| 1087 |
$item['key'].'_section', |
| 1088 |
[ |
| 1089 |
'label' => $item['label'], |
| 1090 |
'tab' => 'tab_layout' |
| 1091 |
] |
| 1092 |
); |
| 1093 |
if($item['key']!='content_card') |
| 1094 |
$this->add_responsive_control( |
| 1095 |
$item['key'].'_hide', |
| 1096 |
[ |
| 1097 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 1098 |
'type' => Controls_Manager::SWITCHER, |
| 1099 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 1100 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 1101 |
'return_value' => 'none', |
| 1102 |
'default' => '', |
| 1103 |
'selectors' => [ |
| 1104 |
'{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};', |
| 1105 |
], |
| 1106 |
] |
| 1107 |
); |
| 1108 |
$selectors = array( |
| 1109 |
'normal' => '{{WRAPPER}} '.$item['selector'], |
| 1110 |
'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s' |
| 1111 |
); |
| 1112 |
|
| 1113 |
if(isset($item['is_featured'])) { |
| 1114 |
$selectors['featured'] = '{{WRAPPER}} '.$item['is_featured']; |
| 1115 |
} |
| 1116 |
$this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); |
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
/* special for some elements */ |
| 1121 |
|
| 1122 |
if($item['key'] == 'content_items') { |
| 1123 |
$this->add_control( |
| 1124 |
$item['key'].'_parent_head', |
| 1125 |
[ |
| 1126 |
'label' => esc_html__('Parent Box', 'wpdirectorykit'), |
| 1127 |
'type' => Controls_Manager::HEADING, |
| 1128 |
'separator' => 'before', |
| 1129 |
] |
| 1130 |
); |
| 1131 |
|
| 1132 |
$selectors = array( |
| 1133 |
'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part', |
| 1134 |
); |
| 1135 |
$this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']); |
| 1136 |
} |
| 1137 |
|
| 1138 |
if ($item['key'] == 'content_description') { |
| 1139 |
|
| 1140 |
$this->add_control( |
| 1141 |
'content_description_limit', |
| 1142 |
[ |
| 1143 |
'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ), |
| 1144 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 1145 |
'min' => 1, |
| 1146 |
'max' => 10, |
| 1147 |
'step' => 1, |
| 1148 |
'default' => 3, |
| 1149 |
'selectors' => [ |
| 1150 |
'{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};', |
| 1151 |
], |
| 1152 |
] |
| 1153 |
); |
| 1154 |
|
| 1155 |
} |
| 1156 |
|
| 1157 |
if($item['key'] == 'content_button' && FALSE) { |
| 1158 |
$this->add_control( |
| 1159 |
$item['key'].'_icon', |
| 1160 |
[ |
| 1161 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 1162 |
'type' => Controls_Manager::ICONS, |
| 1163 |
'label_block' => true, |
| 1164 |
'default' => [ |
| 1165 |
'value' => 'fa fa-angle-right', |
| 1166 |
'library' => 'solid', |
| 1167 |
], |
| 1168 |
] |
| 1169 |
); |
| 1170 |
$this->add_responsive_control( |
| 1171 |
$item['key'].'_text', |
| 1172 |
[ |
| 1173 |
'label' => __( 'Text of Link', 'wpdirectorykit' ), |
| 1174 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 1175 |
'default' => '', |
| 1176 |
] |
| 1177 |
); |
| 1178 |
|
| 1179 |
$selectors = array( |
| 1180 |
'normal' => '{{WRAPPER}} '.$item['selector'].' i', |
| 1181 |
); |
| 1182 |
$this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']); |
| 1183 |
} |
| 1184 |
|
| 1185 |
if($item['key'] == 'content_label') { |
| 1186 |
$this->add_responsive_control( |
| 1187 |
$item['key'] .'content_label_positions_y', |
| 1188 |
[ |
| 1189 |
'label' => __( 'Position Y', 'wpdirectorykit' ), |
| 1190 |
'type' => Controls_Manager::CHOOSE, |
| 1191 |
'options' => [ |
| 1192 |
'top' => [ |
| 1193 |
'title' => esc_html__( 'Top', 'wpdirectorykit' ), |
| 1194 |
'icon' => 'eicon-text-align-top', |
| 1195 |
], |
| 1196 |
'center' => [ |
| 1197 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 1198 |
'icon' => 'eicon-text-align-center', |
| 1199 |
], |
| 1200 |
'bottom' => [ |
| 1201 |
'title' => esc_html__( 'Bottom', 'wpdirectorykit' ), |
| 1202 |
'icon' => 'eicon-text-align-bottom', |
| 1203 |
], |
| 1204 |
], |
| 1205 |
'default' => 'left', |
| 1206 |
'render_type' => 'ui', |
| 1207 |
'selectors_dictionary' => [ |
| 1208 |
'top' => 'top:0;bottom:initial', |
| 1209 |
'center' => 'top:50%;transform: translateY(-50%)', |
| 1210 |
'bottom' => 'top:initial;bottom:0', |
| 1211 |
], |
| 1212 |
'selectors' => [ |
| 1213 |
'{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};', |
| 1214 |
], |
| 1215 |
] |
| 1216 |
); |
| 1217 |
|
| 1218 |
$this->add_responsive_control( |
| 1219 |
$item['key'] .'content_label_positions_x', |
| 1220 |
[ |
| 1221 |
'label' => __( 'Position X', 'wpdirectorykit' ), |
| 1222 |
'type' => Controls_Manager::CHOOSE, |
| 1223 |
'options' => [ |
| 1224 |
'left' => [ |
| 1225 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 1226 |
'icon' => 'eicon-text-align-left', |
| 1227 |
], |
| 1228 |
'center' => [ |
| 1229 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 1230 |
'icon' => 'eicon-text-align-center', |
| 1231 |
], |
| 1232 |
'right' => [ |
| 1233 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 1234 |
'icon' => 'eicon-text-align-right', |
| 1235 |
], |
| 1236 |
], |
| 1237 |
'default' => 'left', |
| 1238 |
'render_type' => 'ui', |
| 1239 |
'selectors_dictionary' => [ |
| 1240 |
'left' => 'left:0', |
| 1241 |
'center' => 'left:50%;transform: translateX(-50%)', |
| 1242 |
'right' => 'left:initial; right:0', |
| 1243 |
], |
| 1244 |
'selectors' => [ |
| 1245 |
'{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};', |
| 1246 |
], |
| 1247 |
] |
| 1248 |
); |
| 1249 |
} |
| 1250 |
|
| 1251 |
if($item['key'] == 'content_type') { |
| 1252 |
$this->add_responsive_control( |
| 1253 |
$item['key'] .'content_label_positions_y', |
| 1254 |
[ |
| 1255 |
'label' => __( 'Position Y', 'wpdirectorykit' ), |
| 1256 |
'type' => Controls_Manager::CHOOSE, |
| 1257 |
'options' => [ |
| 1258 |
'top' => [ |
| 1259 |
'title' => esc_html__( 'Top', 'wpdirectorykit' ), |
| 1260 |
'icon' => 'eicon-text-align-top', |
| 1261 |
], |
| 1262 |
'center' => [ |
| 1263 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 1264 |
'icon' => 'eicon-text-align-center', |
| 1265 |
], |
| 1266 |
'bottom' => [ |
| 1267 |
'title' => esc_html__( 'Bottom', 'wpdirectorykit' ), |
| 1268 |
'icon' => 'eicon-text-align-bottom', |
| 1269 |
], |
| 1270 |
], |
| 1271 |
'default' => 'left', |
| 1272 |
'render_type' => 'ui', |
| 1273 |
'selectors_dictionary' => [ |
| 1274 |
'top' => 'top:0;bottom:initial', |
| 1275 |
'center' => 'top:50%;transform: translateY(-50%)', |
| 1276 |
'bottom' => 'top:initial;bottom:0', |
| 1277 |
], |
| 1278 |
'selectors' => [ |
| 1279 |
'{{WRAPPER}} '.$item['selector'] => '{{VALUE}};', |
| 1280 |
], |
| 1281 |
] |
| 1282 |
); |
| 1283 |
|
| 1284 |
$this->add_responsive_control( |
| 1285 |
$item['key'] .'content_label_positions_x', |
| 1286 |
[ |
| 1287 |
'label' => __( 'Position X', 'wpdirectorykit' ), |
| 1288 |
'type' => Controls_Manager::CHOOSE, |
| 1289 |
'options' => [ |
| 1290 |
'left' => [ |
| 1291 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 1292 |
'icon' => 'eicon-text-align-left', |
| 1293 |
], |
| 1294 |
'center' => [ |
| 1295 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 1296 |
'icon' => 'eicon-text-align-center', |
| 1297 |
], |
| 1298 |
'right' => [ |
| 1299 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 1300 |
'icon' => 'eicon-text-align-right', |
| 1301 |
], |
| 1302 |
'justify' => [ |
| 1303 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 1304 |
'icon' => 'eicon-text-align-justify', |
| 1305 |
], |
| 1306 |
], |
| 1307 |
'default' => 'left', |
| 1308 |
'render_type' => 'ui', |
| 1309 |
'selectors_dictionary' => [ |
| 1310 |
'top' => 'justify-content: flex-start;', |
| 1311 |
'center' => 'justify-content: center;', |
| 1312 |
'bottom' => 'justify-content: flex-end;', |
| 1313 |
'justify' => 'justify-content: stretch;', |
| 1314 |
], |
| 1315 |
'selectors' => [ |
| 1316 |
'{{WRAPPER}} '.$item['selector'] => '{{VALUE}};', |
| 1317 |
], |
| 1318 |
] |
| 1319 |
); |
| 1320 |
} |
| 1321 |
$this->end_controls_section(); |
| 1322 |
/* END special for some elements */ |
| 1323 |
} |
| 1324 |
} |
| 1325 |
|
| 1326 |
|
| 1327 |
public function enqueue_styles_scripts() { |
| 1328 |
wp_enqueue_style('leaflet'); |
| 1329 |
wp_enqueue_style('leaflet-cluster-def'); |
| 1330 |
wp_enqueue_style('leaflet-cluster'); |
| 1331 |
wp_enqueue_script('leaflet'); |
| 1332 |
wp_enqueue_script('leaflet-cluster'); |
| 1333 |
wp_enqueue_script('leaflet-fullscreen'); |
| 1334 |
wp_enqueue_style('leaflet-fullscreen'); |
| 1335 |
|
| 1336 |
wp_enqueue_style('wdk-notify'); |
| 1337 |
wp_enqueue_script('wdk-notify'); |
| 1338 |
wp_enqueue_style( 'wdk-listings-map' ); |
| 1339 |
|
| 1340 |
|
| 1341 |
wp_enqueue_style('slick'); |
| 1342 |
wp_enqueue_style('slick-theme'); |
| 1343 |
wp_enqueue_style('wdk-hover'); |
| 1344 |
wp_enqueue_script('slick'); |
| 1345 |
wp_enqueue_script('leaflet-googlemutant'); |
| 1346 |
|
| 1347 |
wp_enqueue_style('leaflet-draw'); |
| 1348 |
wp_enqueue_script('wdk-map-rectangle'); |
| 1349 |
|
| 1350 |
if( wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')) { |
| 1351 |
wp_enqueue_script( 'wdk-ajax-loading-listings'); |
| 1352 |
} |
| 1353 |
} |
| 1354 |
|
| 1355 |
} |
| 1356 |
|