| 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 WdkSearchPopup 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_contructor', |
| 36 |
esc_html__('Constructor', 'wpdirectorykit') |
| 37 |
); |
| 38 |
|
| 39 |
\Elementor\Controls_Manager::add_tab( |
| 40 |
'tab_layout', |
| 41 |
esc_html__('Style', 'wpdirectorykit') |
| 42 |
); |
| 43 |
|
| 44 |
\Elementor\Controls_Manager::add_tab( |
| 45 |
'tab_form_styles', |
| 46 |
esc_html__('Form Styles', 'wpdirectorykit') |
| 47 |
); |
| 48 |
|
| 49 |
\Elementor\Controls_Manager::add_tab( |
| 50 |
'tab_content', |
| 51 |
esc_html__('Main', 'wpdirectorykit') |
| 52 |
); |
| 53 |
|
| 54 |
if ($this->is_edit_mode_load()) { |
| 55 |
$this->enqueue_styles_scripts(); |
| 56 |
} |
| 57 |
|
| 58 |
parent::__construct($data, $args); |
| 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-search-popup'; |
| 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 Search Popup', '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-search'; |
| 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 |
$this->data['id_element'] = $this->get_id(); |
| 131 |
$this->data['settings'] = $this->get_settings(); |
| 132 |
|
| 133 |
wp_enqueue_script('select2'); |
| 134 |
wp_enqueue_script('wdk-select2'); |
| 135 |
wp_enqueue_style('select2'); |
| 136 |
|
| 137 |
$qr_string = trim($this->data['settings']['conf_predefields_query'],'?'); |
| 138 |
$string_par = array(); |
| 139 |
parse_str($qr_string, $string_par); |
| 140 |
$this->data['predefields_query'] = array_map('trim', $string_par); |
| 141 |
|
| 142 |
if(!empty($this->data['settings']['custom_category_root'])) { |
| 143 |
$this->data['predefields_query']['custom_category_root'] = |
| 144 |
substr($this->data['settings']['custom_category_root'], strpos($this->data['settings']['custom_category_root'],'__')+2); |
| 145 |
} |
| 146 |
|
| 147 |
if(!empty($this->data['settings']['custom_location_root'])) { |
| 148 |
$this->data['predefields_query']['custom_location_root'] = |
| 149 |
substr($this->data['settings']['custom_location_root'], strpos($this->data['settings']['custom_location_root'],'__')+2); |
| 150 |
} |
| 151 |
|
| 152 |
$this->data['is_edit_mode'] = false; |
| 153 |
if(Plugin::$instance->editor->is_edit_mode()) { |
| 154 |
$this->data['is_edit_mode'] = true; |
| 155 |
} |
| 156 |
|
| 157 |
echo $this->view('wdk-search-popup', $this->data); |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
private function generate_controls_conf() { |
| 162 |
$this->start_controls_section( |
| 163 |
'section_config', |
| 164 |
[ |
| 165 |
'label' => __( 'Configuration', 'wpdirectorykit' ), |
| 166 |
] |
| 167 |
); |
| 168 |
|
| 169 |
$this->add_control( |
| 170 |
'auto_search_enable', |
| 171 |
[ |
| 172 |
'label' => __( 'Auto Search Enable', 'wpdirectorykit' ), |
| 173 |
'type' => Controls_Manager::SWITCHER, |
| 174 |
'label_on' => __( 'Show', 'wpdirectorykit' ), |
| 175 |
'label_off' => __( 'Hide', 'wpdirectorykit' ), |
| 176 |
'return_value' => 'yes', |
| 177 |
'default' => '', |
| 178 |
] |
| 179 |
); |
| 180 |
|
| 181 |
$pages = array('' => __('Not Selected', 'wpdirectorykit')); |
| 182 |
foreach(get_pages(array('sort_column' => 'post_title')) as $page) |
| 183 |
{ |
| 184 |
$pages[$page->ID] = $page->post_title.' #'.$page->ID; |
| 185 |
} |
| 186 |
|
| 187 |
$this->add_control( |
| 188 |
'conf_link', |
| 189 |
[ |
| 190 |
'label' => __( 'Open results on page', 'wpdirectorykit' ), |
| 191 |
'type' => \Elementor\Controls_Manager::SELECT2, |
| 192 |
'default' => '', |
| 193 |
'options' => $pages |
| 194 |
] |
| 195 |
); |
| 196 |
|
| 197 |
$this->add_responsive_control( |
| 198 |
'search_scroll', |
| 199 |
[ |
| 200 |
'label' => __( 'On search scroll to', 'wpdirectorykit' ), |
| 201 |
'type' => Controls_Manager::SELECT, |
| 202 |
'options' => [ |
| 203 |
'' => esc_html__('No scroll', 'wpdirectorykit'), |
| 204 |
'results' => esc_html__('Results', 'wpdirectorykit'), |
| 205 |
'wdk_map_results' => esc_html__('Map', 'wpdirectorykit'), |
| 206 |
], |
| 207 |
'default' => 'results', |
| 208 |
] |
| 209 |
); |
| 210 |
|
| 211 |
$WMVC = &wdk_get_instance(); |
| 212 |
$WMVC->model('field_m'); |
| 213 |
$fields = $WMVC->field_m->get_by(array('field_type' => 'DROPDOWN')); |
| 214 |
|
| 215 |
$fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 216 |
$order_i = 0; |
| 217 |
foreach($fields as $field) |
| 218 |
{ |
| 219 |
$fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field); |
| 220 |
} |
| 221 |
|
| 222 |
$this->add_control( |
| 223 |
'conf_predefields_query', |
| 224 |
[ |
| 225 |
'label' => __( 'Default Search Fields Values', 'wpdirectorykit' ), |
| 226 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 227 |
'rows' => 5, |
| 228 |
'default' => '', |
| 229 |
'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ), |
| 230 |
'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url):', 'wpdirectorykit' ). |
| 231 |
' field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4'. |
| 232 |
'</span>', |
| 233 |
] |
| 234 |
); |
| 235 |
|
| 236 |
$WMVC = &wdk_get_instance(); |
| 237 |
$WMVC->model('category_m'); |
| 238 |
$WMVC->model('location_m'); |
| 239 |
$categories_data = $WMVC->category_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL)); |
| 240 |
$categories_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 241 |
$order_i = 0; |
| 242 |
|
| 243 |
foreach($categories_data as $category) |
| 244 |
{ |
| 245 |
$categories_list[(++$order_i).'__'.wmvc_show_data('idcategory', $category)] = '#'.wmvc_show_data('idcategory', $category).' '.wmvc_show_data('category_title', $category); |
| 246 |
} |
| 247 |
$this->add_control( |
| 248 |
'custom_category_root', |
| 249 |
[ |
| 250 |
'label' => __( 'Custom Category Root', 'wpdirectorykit' ), |
| 251 |
'type' => Controls_Manager::SELECT2, |
| 252 |
'options' => $categories_list, |
| 253 |
'default' => 'results', |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
$locations_data = $WMVC->location_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL)); |
| 258 |
$locations_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 259 |
$order_i = 0; |
| 260 |
|
| 261 |
foreach($locations_data as $location) |
| 262 |
{ |
| 263 |
$locations_list[(++$order_i).'__'.wmvc_show_data('idlocation', $location)] = '#'.wmvc_show_data('idlocation', $location).' '.wmvc_show_data('location_title', $location); |
| 264 |
} |
| 265 |
$this->add_control( |
| 266 |
'custom_location_root', |
| 267 |
[ |
| 268 |
'label' => __( 'Custom Location Root', 'wpdirectorykit' ), |
| 269 |
'type' => Controls_Manager::SELECT2, |
| 270 |
'options' => $locations_list, |
| 271 |
'default' => 'results', |
| 272 |
] |
| 273 |
); |
| 274 |
|
| 275 |
$this->end_controls_section(); |
| 276 |
} |
| 277 |
|
| 278 |
private function generate_controls_layout() { |
| 279 |
|
| 280 |
/* Buttons Search / Save / More */ |
| 281 |
$this->start_controls_section( |
| 282 |
'section_filter_button', |
| 283 |
[ |
| 284 |
'label' => __( 'Open Form Button', 'wpdirectorykit' ), |
| 285 |
'tab' => 'tab_contructor', |
| 286 |
] |
| 287 |
); |
| 288 |
|
| 289 |
$this->add_control( |
| 290 |
'text_toggle_button', |
| 291 |
[ |
| 292 |
'label' => __( 'Text for open Filters Button', 'wpdirectorykit' ), |
| 293 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 294 |
'label_block' => true, |
| 295 |
'default' => __( 'Filters', 'wpdirectorykit' ), |
| 296 |
] |
| 297 |
); |
| 298 |
|
| 299 |
$this->add_responsive_control( |
| 300 |
'section_filter_button_header_1', |
| 301 |
[ |
| 302 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 303 |
'type' => Controls_Manager::HEADING, |
| 304 |
'separator' => 'before', |
| 305 |
] |
| 306 |
); |
| 307 |
|
| 308 |
$this->add_control( |
| 309 |
'text_toggle_button_icon', |
| 310 |
[ |
| 311 |
'label' => __( 'Icon', 'text-domain' ), |
| 312 |
'type' => Controls_Manager::ICONS, |
| 313 |
] |
| 314 |
); |
| 315 |
|
| 316 |
$this->add_control( |
| 317 |
'text_toggle_button_icon_position', |
| 318 |
[ |
| 319 |
'label' => esc_html__('icon Position', 'wdk-compare-listing'), |
| 320 |
'type' => Controls_Manager::SELECT, |
| 321 |
'options' => [ |
| 322 |
'left' => esc_html__('Left', 'wdk-compare-listing'), |
| 323 |
'right' => esc_html__('Right', 'wdk-compare-listing'), |
| 324 |
], |
| 325 |
'default' => 'left', |
| 326 |
] |
| 327 |
); |
| 328 |
|
| 329 |
$selectors = array(); |
| 330 |
$selectors['normal'] = '{{WRAPPER}} .toggle-btn .icon_popup'; |
| 331 |
$selectors['hover'] = '{{WRAPPER}} .toggle-btn .icon_popup%1$s'; |
| 332 |
$this->generate_renders_tabs($selectors, 'text_toggle_button_icon_dynamic', array('margin','font-size')); |
| 333 |
|
| 334 |
$this->add_responsive_control( |
| 335 |
'section_filter_button_header_2', |
| 336 |
[ |
| 337 |
'label' => esc_html__('Button Styles', 'wpdirectorykit'), |
| 338 |
'type' => Controls_Manager::HEADING, |
| 339 |
'separator' => 'before', |
| 340 |
] |
| 341 |
); |
| 342 |
|
| 343 |
$selectors = array(); |
| 344 |
$selectors['normal'] = '{{WRAPPER}} .toggle-btn'; |
| 345 |
$selectors['hover'] = '{{WRAPPER}} .toggle-btn%1$s'; |
| 346 |
$this->generate_renders_tabs($selectors, 'text_toggle_button_dynamic', array('align','margin','typo','color','border','border_radius','padding','shadow','transition', 'height', 'width','background_group')); |
| 347 |
|
| 348 |
$this->end_controls_section(); |
| 349 |
|
| 350 |
/* TAB_STYLE */ |
| 351 |
$this->start_controls_section( |
| 352 |
'section_form_style', |
| 353 |
[ |
| 354 |
'label' => __( 'Search Form Popup', 'wpdirectorykit' ), |
| 355 |
'tab' => 'tab_contructor', |
| 356 |
] |
| 357 |
); |
| 358 |
|
| 359 |
$this->add_control( |
| 360 |
'text_popup', |
| 361 |
[ |
| 362 |
'label' => __( 'Popup Title Text', 'wpdirectorykit' ), |
| 363 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 364 |
'label_block' => true, |
| 365 |
'default' => __( 'Search Form', 'wpdirectorykit' ), |
| 366 |
'render_type' => 'ui' |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
$this->add_responsive_control( |
| 371 |
'row_gap_col_inline', |
| 372 |
[ |
| 373 |
'label' => __( 'Gaps', 'wpdirectorykit' ), |
| 374 |
'type' => Controls_Manager::GAPS, |
| 375 |
'size_units' => [ 'px', '%', 'em', 'rem', 'vm', 'custom' ], |
| 376 |
'options' => [ |
| 377 |
'' => esc_html__('Default', 'wpdirectorykit'), |
| 378 |
'auto' => esc_html__('Auto', 'wpdirectorykit'), |
| 379 |
'100%' => '1', |
| 380 |
'50%' => '2', |
| 381 |
'calc(100% / 3)' => '3', |
| 382 |
'25%' => '4', |
| 383 |
'20%' => '5', |
| 384 |
'auto_flexible' => 'auto flexible', |
| 385 |
], |
| 386 |
'selectors' => [ |
| 387 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-fields-list' => 'gap:{{ROW}}{{UNIT}} {{COLUMN}}{{UNIT}}', |
| 388 |
], |
| 389 |
'default' => [ |
| 390 |
'unit' => 'px', |
| 391 |
], |
| 392 |
'separator' => 'before', |
| 393 |
|
| 394 |
] |
| 395 |
); |
| 396 |
|
| 397 |
$this->add_responsive_control( |
| 398 |
'section_form_style_heigth', |
| 399 |
[ |
| 400 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 401 |
'type' => Controls_Manager::SLIDER, |
| 402 |
'range' => [ |
| 403 |
'px' => [ |
| 404 |
'min' => 10, |
| 405 |
'max' => 1500, |
| 406 |
], |
| 407 |
'vw' => [ |
| 408 |
'min' => 0, |
| 409 |
'max' => 100, |
| 410 |
], |
| 411 |
'%' => [ |
| 412 |
'min' => 0, |
| 413 |
'max' => 100, |
| 414 |
], |
| 415 |
], |
| 416 |
'size_units' => [ 'px', 'vw','%' ], |
| 417 |
'selectors' => [ |
| 418 |
'#wdk_search_popup_modal_'.$this->get_id().' .modal-dialog' => 'height: {{SIZE}}{{UNIT}}', |
| 419 |
], |
| 420 |
|
| 421 |
] |
| 422 |
); |
| 423 |
|
| 424 |
$this->add_responsive_control( |
| 425 |
'section_form_style_width', |
| 426 |
[ |
| 427 |
'label' => esc_html__('Width', 'wpdirectorykit'), |
| 428 |
'type' => Controls_Manager::SLIDER, |
| 429 |
'range' => [ |
| 430 |
'px' => [ |
| 431 |
'min' => 10, |
| 432 |
'max' => 1500, |
| 433 |
], |
| 434 |
'vw' => [ |
| 435 |
'min' => 0, |
| 436 |
'max' => 100, |
| 437 |
], |
| 438 |
'%' => [ |
| 439 |
'min' => 0, |
| 440 |
'max' => 100, |
| 441 |
], |
| 442 |
], |
| 443 |
'size_units' => [ 'px', 'vw','%' ], |
| 444 |
'selectors' => [ |
| 445 |
'#wdk_search_popup_modal_'.$this->get_id().' .modal-dialog' => 'width: {{SIZE}}{{UNIT}}', |
| 446 |
], |
| 447 |
|
| 448 |
] |
| 449 |
); |
| 450 |
|
| 451 |
|
| 452 |
$this->add_control( |
| 453 |
'section_form_style_header_hr_1', |
| 454 |
[ |
| 455 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 456 |
] |
| 457 |
); |
| 458 |
|
| 459 |
$this->add_responsive_control( |
| 460 |
'section_form_style_header_1', |
| 461 |
[ |
| 462 |
'label' => esc_html__('Popup Styles', 'wpdirectorykit'), |
| 463 |
'type' => Controls_Manager::HEADING, |
| 464 |
] |
| 465 |
); |
| 466 |
|
| 467 |
$this->add_control( |
| 468 |
'section_form_style_hr_2', |
| 469 |
[ |
| 470 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 471 |
] |
| 472 |
); |
| 473 |
|
| 474 |
$selectors = array(); |
| 475 |
$selectors['normal'] = '#wdk_search_popup_modal_'.$this->get_id().' .wdk-modal .modal-dialog'; |
| 476 |
$this->generate_renders_tabs($selectors, 'section_form_style_popup_dynamic', array('border','border_radius','shadow')); |
| 477 |
|
| 478 |
|
| 479 |
$this->add_control( |
| 480 |
'section_form_style_header_hr_3', |
| 481 |
[ |
| 482 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 483 |
] |
| 484 |
); |
| 485 |
|
| 486 |
$this->add_responsive_control( |
| 487 |
'section_form_style_header_5', |
| 488 |
[ |
| 489 |
'label' => esc_html__('Popup Header Styles', 'wpdirectorykit'), |
| 490 |
'type' => Controls_Manager::HEADING, |
| 491 |
] |
| 492 |
); |
| 493 |
|
| 494 |
$this->add_control( |
| 495 |
'section_form_style_header_hr_4', |
| 496 |
[ |
| 497 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 498 |
] |
| 499 |
); |
| 500 |
|
| 501 |
$selectors = array(); |
| 502 |
$selectors['normal'] = '#wdk_search_popup_modal_'.$this->get_id().' .wdk-modal .modal-dialog .modal-header'; |
| 503 |
$this->generate_renders_tabs($selectors, 'section_form_style_header_dynamic', array('align','typo','color','padding','background_group')); |
| 504 |
|
| 505 |
/* |
| 506 |
$this->add_control( |
| 507 |
'section_form_style_header_hr_5', |
| 508 |
[ |
| 509 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 510 |
] |
| 511 |
);*/ |
| 512 |
|
| 513 |
$this->add_responsive_control( |
| 514 |
'section_form_style_header_2', |
| 515 |
[ |
| 516 |
'label' => esc_html__('Popup Content Styles', 'wpdirectorykit'), |
| 517 |
'type' => Controls_Manager::HEADING, |
| 518 |
] |
| 519 |
); |
| 520 |
|
| 521 |
$this->add_control( |
| 522 |
'section_form_style_header_hr_6', |
| 523 |
[ |
| 524 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 525 |
] |
| 526 |
); |
| 527 |
|
| 528 |
$selectors = array(); |
| 529 |
$selectors['normal'] = '#wdk_search_popup_modal_'.$this->get_id().' .wdk-modal .modal-dialog .modal-body'; |
| 530 |
$this->generate_renders_tabs($selectors, 'section_form_style_body_dynamic', array('padding','background_group')); |
| 531 |
/* |
| 532 |
$this->add_control( |
| 533 |
'section_form_style_header_hr_7', |
| 534 |
[ |
| 535 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 536 |
] |
| 537 |
); |
| 538 |
*/ |
| 539 |
$this->add_responsive_control( |
| 540 |
'section_form_style_header_3', |
| 541 |
[ |
| 542 |
'label' => esc_html__('Popup Footer Styles', 'wpdirectorykit'), |
| 543 |
'type' => Controls_Manager::HEADING, |
| 544 |
] |
| 545 |
); |
| 546 |
|
| 547 |
$this->add_control( |
| 548 |
'section_form_style_header_hr_8', |
| 549 |
[ |
| 550 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 551 |
] |
| 552 |
); |
| 553 |
|
| 554 |
$selectors = array(); |
| 555 |
$selectors['normal'] = '#wdk_search_popup_modal_'.$this->get_id().' .wdk-modal .modal-dialog .modal-footer'; |
| 556 |
$this->generate_renders_tabs($selectors, 'section_form_style_footer_dynamic', array('padding','background_group')); |
| 557 |
|
| 558 |
$this->add_control( |
| 559 |
'heading_suc_message', |
| 560 |
[ |
| 561 |
'label' => __( 'Fields', 'wpdirectorykit' ), |
| 562 |
'type' => Controls_Manager::HEADING, |
| 563 |
] |
| 564 |
); |
| 565 |
|
| 566 |
$this->add_control( |
| 567 |
'fields_height', |
| 568 |
[ |
| 569 |
'label' => __( 'Fields height', 'wpdirectorykit' ), |
| 570 |
'type' => Controls_Manager::SLIDER, |
| 571 |
'render_type' => 'template', |
| 572 |
'range' => [ |
| 573 |
'px' => [ |
| 574 |
'min' => 20, |
| 575 |
'max' => 400, |
| 576 |
], |
| 577 |
], |
| 578 |
'selectors' => [ |
| 579 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field label.checkbox, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="text"],#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="number"], #wdk_search_popup_modal_'.$this->get_id().' .wdk-field select' => 'height: {{SIZE}}{{UNIT}};', |
| 580 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree > .btn-group' => 'height: {{SIZE}}{{UNIT}};', |
| 581 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CHECKBOX' => 'height: {{SIZE}}{{UNIT}};', |
| 582 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field button.wdk-search-popup-additional-btn, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field button.wdk-search-popup-start' => 'height: {{SIZE}}{{UNIT}};', |
| 583 |
], |
| 584 |
] |
| 585 |
); |
| 586 |
|
| 587 |
$this->add_control( |
| 588 |
'fields_height_multi', |
| 589 |
[ |
| 590 |
'label' => __( 'Select Multiple', 'wpdirectorykit' ), |
| 591 |
'type' => Controls_Manager::SLIDER, |
| 592 |
'render_type' => 'template', |
| 593 |
'range' => [ |
| 594 |
'px' => [ |
| 595 |
'min' => 20, |
| 596 |
'max' => 400, |
| 597 |
], |
| 598 |
], |
| 599 |
'selectors' => [ |
| 600 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field select[multiple="multiple"]' => 'height: {{SIZE}}{{UNIT}};', |
| 601 |
], |
| 602 |
] |
| 603 |
); |
| 604 |
|
| 605 |
if(true){ |
| 606 |
|
| 607 |
$fields_data = wdk_cached_field_get(); |
| 608 |
$fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 609 |
$order_i = 0; |
| 610 |
$fields_allow_types = array(); |
| 611 |
$fields_allow_tree_types = array(); |
| 612 |
|
| 613 |
$fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit'); |
| 614 |
$fields_list [(++$order_i).'__search'] = esc_html__('Smart Search', 'wpdirectorykit'); |
| 615 |
|
| 616 |
if(function_exists('run_wdk_bookings')) |
| 617 |
$fields_list [(++$order_i).'__booking_date'] = esc_html__('Booking Date', 'wpdirectorykit'); |
| 618 |
|
| 619 |
$fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit'); |
| 620 |
$fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit'); |
| 621 |
$fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit'); |
| 622 |
$fields_allow_tree_types[] = $order_i.'__category_id'; |
| 623 |
$fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit'); |
| 624 |
$fields_allow_tree_types[] = $order_i.'__location_id'; |
| 625 |
|
| 626 |
foreach($fields_data as $field) |
| 627 |
{ |
| 628 |
if(in_array(wmvc_show_data('field_type', $field),array('TEXTAREA','TEXTAREA_WYSIWYG'))) { |
| 629 |
continue; |
| 630 |
} else if(in_array(wmvc_show_data('field_type', $field),array('SECTION'))) { |
| 631 |
$fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --'; |
| 632 |
} else { |
| 633 |
$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).']'; |
| 634 |
} |
| 635 |
|
| 636 |
if(wmvc_show_data('field_type', $field) == 'NUMBER') { |
| 637 |
$fields_allow_types[] = $order_i.'__'.wmvc_show_data('idfield', $field); |
| 638 |
} |
| 639 |
} |
| 640 |
|
| 641 |
$repeater = new Repeater(); |
| 642 |
$repeater->start_controls_tabs( 'custom_fields_repeat' ); |
| 643 |
|
| 644 |
$repeater->add_control( |
| 645 |
'field_id', |
| 646 |
[ |
| 647 |
'label' => __( 'Field id', 'wpdirectorykit' ), |
| 648 |
'type' => \Elementor\Controls_Manager::SELECT2, |
| 649 |
'default' => '', |
| 650 |
'options' => $fields_list, |
| 651 |
'separator' => 'after', |
| 652 |
] |
| 653 |
); |
| 654 |
|
| 655 |
$repeater->add_control( |
| 656 |
'field_css_class', |
| 657 |
[ |
| 658 |
'label' => __( 'Css Class', 'wpdirectorykit' ), |
| 659 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 660 |
'default' => '', |
| 661 |
] |
| 662 |
); |
| 663 |
|
| 664 |
$repeater->add_control( |
| 665 |
'field_placeholder', |
| 666 |
[ |
| 667 |
'label' => __( 'Placeholder', 'wpdirectorykit' ), |
| 668 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 669 |
'default' => $repeater->get_id(), |
| 670 |
] |
| 671 |
); |
| 672 |
|
| 673 |
|
| 674 |
$repeater->add_control( |
| 675 |
'field_columns_number', |
| 676 |
[ |
| 677 |
'label' => __( 'Columns/Width', 'wpdirectorykit' ), |
| 678 |
'type' => \Elementor\Controls_Manager::HIDDEN, |
| 679 |
'min' => '0', |
| 680 |
'max' => '12', |
| 681 |
'step' => '1', |
| 682 |
'default' => '', |
| 683 |
] |
| 684 |
); |
| 685 |
|
| 686 |
$repeater->add_control( |
| 687 |
'field_columns_width', |
| 688 |
[ |
| 689 |
'label' => __( 'Columns', 'wpdirectorykit' ), |
| 690 |
'type' => Controls_Manager::SELECT, |
| 691 |
'options' => [ |
| 692 |
'auto' => esc_html__('Auto', 'wpdirectorykit'), |
| 693 |
'25%' => '25%', |
| 694 |
'50%' => '50%', |
| 695 |
'100%' => "100%" |
| 696 |
], |
| 697 |
'selectors_dictionary' => [ |
| 698 |
'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto', |
| 699 |
'100%' => 'grid-column: span 12;', |
| 700 |
'50%' => 'grid-column: span 6;', |
| 701 |
'calc(100% / 3)' => 'grid-column: span 4;', |
| 702 |
'25%' => 'grid-column: span 3;', |
| 703 |
'20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%', |
| 704 |
'auto' => 'grid-column: span 12;', |
| 705 |
], |
| 706 |
'default' => '100%', |
| 707 |
'separator' => 'before', |
| 708 |
'selectors' => [ |
| 709 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-fields-list {{CURRENT_ITEM}}' => '{{UNIT}}', |
| 710 |
], |
| 711 |
] |
| 712 |
); |
| 713 |
|
| 714 |
$repeater->add_control( |
| 715 |
'search_type_tree', |
| 716 |
[ |
| 717 |
'label' => __( 'Field Layout', 'wpdirectorykit' ), |
| 718 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 719 |
'default' => '', |
| 720 |
'options' => array( |
| 721 |
'' => __( 'Default', 'wpdirectorykit' ), |
| 722 |
'_checkboxes' => __( 'Checkboxes', 'wpdirectorykit' ), |
| 723 |
/*'_tree' => __( 'Tree with Search', 'wpdirectorykit' ), |
| 724 |
'_multi_selector' => __( 'Tree multi Select', 'wpdirectorykit' ), |
| 725 |
'_multi_selects' => __( 'Multi Selects', 'wpdirectorykit' ),*/ |
| 726 |
), |
| 727 |
'condition' => [ |
| 728 |
'field_id' => $fields_allow_tree_types, |
| 729 |
], |
| 730 |
] |
| 731 |
); |
| 732 |
|
| 733 |
$repeater->add_control( |
| 734 |
'search_type_tree_hide', |
| 735 |
[ |
| 736 |
'label' => __( 'Hide by id', 'wpdirectorykit' ), |
| 737 |
'description' => __( 'Hide locations/categories based on id, example 1,2,3,4,xxx', 'wpdirectorykit' ), |
| 738 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 739 |
'default' => '', |
| 740 |
'condition' => [ |
| 741 |
'field_id' => $fields_allow_tree_types, |
| 742 |
], |
| 743 |
] |
| 744 |
); |
| 745 |
|
| 746 |
$repeater->add_control( |
| 747 |
'search_type', |
| 748 |
[ |
| 749 |
'label' => __( 'Search Type', 'wpdirectorykit' ), |
| 750 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 751 |
'default' => '', |
| 752 |
'options' => array( |
| 753 |
'' => __( 'None', 'wpdirectorykit' ), |
| 754 |
'min' => __( 'Min', 'wpdirectorykit' ), |
| 755 |
'max' => __( 'Max', 'wpdirectorykit' ), |
| 756 |
'min_max' => __( 'Min/Max', 'wpdirectorykit' ), |
| 757 |
'slider_range' => __( 'Slider Range', 'wpdirectorykit' ), |
| 758 |
), |
| 759 |
'condition' => [ |
| 760 |
'field_id' => $fields_allow_types, |
| 761 |
], |
| 762 |
] |
| 763 |
); |
| 764 |
|
| 765 |
$repeater->add_control( |
| 766 |
'value_min', |
| 767 |
[ |
| 768 |
'label' => __( 'Value Min', 'wpdirectorykit' ), |
| 769 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 770 |
'default' => '', |
| 771 |
'conditions' => [ |
| 772 |
'terms' => [ |
| 773 |
[ |
| 774 |
'name' => 'search_type', |
| 775 |
'operator' => '==', |
| 776 |
'value' => 'slider_range', |
| 777 |
] |
| 778 |
], |
| 779 |
], |
| 780 |
] |
| 781 |
); |
| 782 |
|
| 783 |
$repeater->add_control( |
| 784 |
'value_max', |
| 785 |
[ |
| 786 |
'label' => __( 'Value Max', 'wpdirectorykit' ), |
| 787 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 788 |
'default' => '', |
| 789 |
'conditions' => [ |
| 790 |
'terms' => [ |
| 791 |
[ |
| 792 |
'name' => 'search_type', |
| 793 |
'operator' => '==', |
| 794 |
'value' => 'slider_range', |
| 795 |
] |
| 796 |
], |
| 797 |
], |
| 798 |
] |
| 799 |
); |
| 800 |
|
| 801 |
$repeater->end_controls_tabs(); |
| 802 |
|
| 803 |
|
| 804 |
$this->add_control( |
| 805 |
'custom_fields_header_main_hr_1', |
| 806 |
[ |
| 807 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 808 |
] |
| 809 |
); |
| 810 |
|
| 811 |
$this->add_responsive_control( |
| 812 |
'custom_fields_header_main_1', |
| 813 |
[ |
| 814 |
'label' => esc_html__('Popup Constructor', 'wpdirectorykit').':', |
| 815 |
'type' => Controls_Manager::HEADING, |
| 816 |
] |
| 817 |
); |
| 818 |
/* |
| 819 |
$this->add_control( |
| 820 |
'custom_fields_header_main_hr_2', |
| 821 |
[ |
| 822 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 823 |
] |
| 824 |
);*/ |
| 825 |
|
| 826 |
$this->add_control( |
| 827 |
'custom_fields_header_hr_1', |
| 828 |
[ |
| 829 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 830 |
] |
| 831 |
); |
| 832 |
|
| 833 |
$this->add_responsive_control( |
| 834 |
'custom_fields_header_1', |
| 835 |
[ |
| 836 |
'label' => esc_html__('Search Fields:', 'wpdirectorykit'), |
| 837 |
'type' => Controls_Manager::HEADING, |
| 838 |
] |
| 839 |
); |
| 840 |
|
| 841 |
$this->add_control( |
| 842 |
'custom_fields_header_hr_2', |
| 843 |
[ |
| 844 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 845 |
] |
| 846 |
); |
| 847 |
|
| 848 |
|
| 849 |
$this->add_control( |
| 850 |
'custom_fields', |
| 851 |
[ |
| 852 |
'type' => Controls_Manager::REPEATER, |
| 853 |
'fields' => $repeater->get_controls(), |
| 854 |
'label' => __( 'Fields', 'wpdirectorykit' ), |
| 855 |
'render_type' => 'template', |
| 856 |
'default' => [ |
| 857 |
], |
| 858 |
'title_field' => "<# " |
| 859 |
. "let labels = ".json_encode($fields_list)."; " |
| 860 |
. "let label = labels[field_id]; " |
| 861 |
. "#>" |
| 862 |
. "{{{ label }}}", |
| 863 |
] |
| 864 |
); |
| 865 |
} |
| 866 |
|
| 867 |
if(true){ |
| 868 |
|
| 869 |
$action_list_button = array( |
| 870 |
'button_reset' => __( 'Reset Button', 'wpdirectorykit' ), |
| 871 |
'button_search' => __( 'Search Button', 'wpdirectorykit' ), |
| 872 |
'button_close' => __( 'Close Button', 'wpdirectorykit' ), |
| 873 |
); |
| 874 |
|
| 875 |
$repeater = new Repeater(); |
| 876 |
$repeater->start_controls_tabs( 'custom_buttons_repeat' ); |
| 877 |
|
| 878 |
$repeater->add_control( |
| 879 |
'action_list_field_id', |
| 880 |
[ |
| 881 |
'label' => __( 'Elements', 'wpdirectorykit' ), |
| 882 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 883 |
'default' => '', |
| 884 |
'options' => $action_list_button, |
| 885 |
'separator' => 'after', |
| 886 |
'render_type' => 'template', |
| 887 |
] |
| 888 |
); |
| 889 |
|
| 890 |
$repeater->add_control( |
| 891 |
'placeholder', |
| 892 |
[ |
| 893 |
'label' => __( 'Title of button', 'wpdirectorykit' ), |
| 894 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 895 |
'default' => '', |
| 896 |
] |
| 897 |
); |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
$repeater->end_controls_tabs(); |
| 902 |
|
| 903 |
|
| 904 |
$this->add_control( |
| 905 |
'custom_fields_header_hr_3', |
| 906 |
[ |
| 907 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 908 |
] |
| 909 |
); |
| 910 |
|
| 911 |
$this->add_responsive_control( |
| 912 |
'custom_fields_header_2', |
| 913 |
[ |
| 914 |
'label' => esc_html__('Footer Actions:', 'wpdirectorykit'), |
| 915 |
'type' => Controls_Manager::HEADING, |
| 916 |
] |
| 917 |
); |
| 918 |
|
| 919 |
$this->add_control( |
| 920 |
'custom_fields_header_hr_4', |
| 921 |
[ |
| 922 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 923 |
] |
| 924 |
); |
| 925 |
|
| 926 |
$this->add_control( |
| 927 |
'custom_buttons', |
| 928 |
[ |
| 929 |
'type' => Controls_Manager::REPEATER, |
| 930 |
'fields' => $repeater->get_controls(), |
| 931 |
'label' => __( 'Buttons', 'wpdirectorykit' ), |
| 932 |
'default' => [ |
| 933 |
[ |
| 934 |
'action_list_field_id' => 'button_search', |
| 935 |
], |
| 936 |
[ |
| 937 |
'action_list_field_id' => 'button_reset', |
| 938 |
], |
| 939 |
[ |
| 940 |
'action_list_field_id' => 'button_close', |
| 941 |
], |
| 942 |
], |
| 943 |
'title_field' => "<# " |
| 944 |
. "let labels = ".json_encode($action_list_button)."; " |
| 945 |
. "let label = labels[action_list_field_id]; " |
| 946 |
. "#>" |
| 947 |
. "{{{ label }}}", |
| 948 |
] |
| 949 |
); |
| 950 |
|
| 951 |
} |
| 952 |
|
| 953 |
$this->end_controls_section(); |
| 954 |
|
| 955 |
} |
| 956 |
|
| 957 |
private function generate_controls_styles() { |
| 958 |
$items = [ |
| 959 |
[ |
| 960 |
'key'=>'field_label', |
| 961 |
'label'=> esc_html__('Field Label', 'wpdirectorykit'), |
| 962 |
//'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field:not(.CHECKBOX) .wdk-field-label', |
| 963 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field:not(.CHECKBOX) .wdk-field-label', |
| 964 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field:not(.CHECKBOX) .wdk-field-label%1$s', |
| 965 |
'options'=>'full', |
| 966 |
], |
| 967 |
[ |
| 968 |
'key'=>'field_text', |
| 969 |
'label'=> esc_html__('Field Text/Integer', 'wpdirectorykit'), |
| 970 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.INPUTBOX,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.NUMBER,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.TEXTAREA', |
| 971 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="text"],#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="number"]', |
| 972 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="text"]%1$s,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="number"]%1$s', |
| 973 |
'selector_focus'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="text"]:focus,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="number"]:focus', |
| 974 |
'options'=>'full', |
| 975 |
], |
| 976 |
[ |
| 977 |
'key'=>'field_select', |
| 978 |
'label'=> esc_html__('Field Select', 'wpdirectorykit'), |
| 979 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWN', |
| 980 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWN select', |
| 981 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWN select%1$s', |
| 982 |
'options'=>'full', |
| 983 |
], |
| 984 |
[ |
| 985 |
'key'=>'field_checkbox', |
| 986 |
'label'=> esc_html__('Field Checkbox', 'wpdirectorykit'), |
| 987 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CHECKBOX', |
| 988 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CHECKBOX .wdk-field-label', |
| 989 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CHECKBOX .wdk-field-label%1$s', |
| 990 |
'options'=>'full', |
| 991 |
], |
| 992 |
[ |
| 993 |
'key'=>'field_tree', |
| 994 |
'label'=> esc_html__('Field Category / Location', 'wpdirectorykit'), |
| 995 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION', |
| 996 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2', |
| 997 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group%1$s, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2%1$s, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2%1$s', |
| 998 |
'options'=> ['margin','background','border','border_radius','padding','shadow','transition'], |
| 999 |
], |
| 1000 |
[ |
| 1001 |
'key'=>'field_select2', |
| 1002 |
'label'=> esc_html__('Dropdown Multi-Select', 'wpdirectorykit'), |
| 1003 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE', |
| 1004 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2', |
| 1005 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2%1$s', |
| 1006 |
'options'=>['margin','background','border','border_radius','padding','shadow','transition'], |
| 1007 |
], |
| 1008 |
[ |
| 1009 |
'key'=>'field_slider_range', |
| 1010 |
'label'=> esc_html__('Field Slider Range', 'wpdirectorykit'), |
| 1011 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.SLIDER_RANGE', |
| 1012 |
'selector'=>'', |
| 1013 |
'selector_hover'=>'', |
| 1014 |
'options'=>'', |
| 1015 |
], |
| 1016 |
[ |
| 1017 |
'key'=>'field_button_search', |
| 1018 |
'label'=> esc_html__('Search Button', 'wpdirectorykit'), |
| 1019 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer button.wdk-button-search-start', |
| 1020 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer button.wdk-button-search-start', |
| 1021 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer button.wdk-button-search-start%1$s', |
| 1022 |
'options'=>'full', |
| 1023 |
], |
| 1024 |
[ |
| 1025 |
'key'=>'field_button_reset', |
| 1026 |
'label'=> esc_html__('Reset Button', 'wpdirectorykit'), |
| 1027 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer .wdk-button-search-reset', |
| 1028 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer .wdk-button-search-reset', |
| 1029 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().'.modal-footer .wdk-button-search-reset%1$s', |
| 1030 |
'options'=>['typo','color','border','border_radius','shadow','transition','background_group'], |
| 1031 |
], |
| 1032 |
[ |
| 1033 |
'key'=>'field_button_close', |
| 1034 |
'label'=> esc_html__('Close Button', 'wpdirectorykit'), |
| 1035 |
'selector_hide'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer .wdk-button-close', |
| 1036 |
'selector'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer .wdk-button-close', |
| 1037 |
'selector_hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .modal-footer .wdk-field .wdk-button-close%1$s', |
| 1038 |
'options'=>['typo','color','border','border_radius','shadow','transition','background_group'], |
| 1039 |
], |
| 1040 |
]; |
| 1041 |
|
| 1042 |
foreach ($items as $item) { |
| 1043 |
$this->start_controls_section( |
| 1044 |
$item['key'].'_section', |
| 1045 |
[ |
| 1046 |
'label' => $item['label'], |
| 1047 |
'tab' => 'tab_form_styles', |
| 1048 |
] |
| 1049 |
); |
| 1050 |
|
| 1051 |
if($item['key'] == 'field_label') { |
| 1052 |
$this->add_responsive_control ( |
| 1053 |
'f_label_hide', |
| 1054 |
[ |
| 1055 |
'label' => esc_html__( 'Field Label Hide', 'wpdirectorykit' ), |
| 1056 |
|
| 1057 |
'type' => Controls_Manager::SWITCHER, |
| 1058 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 1059 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 1060 |
'return_value' => 'none', |
| 1061 |
'default' => '', |
| 1062 |
'selectors' => [ |
| 1063 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field:not(.CHECKBOX) .wdk-field-label' => 'display: {{VALUE}};', |
| 1064 |
], |
| 1065 |
'separator' => 'before', |
| 1066 |
] |
| 1067 |
); |
| 1068 |
} else { |
| 1069 |
|
| 1070 |
if(!empty($item['selector_hide'])) { |
| 1071 |
$this->add_responsive_control( |
| 1072 |
$item['key'].'_hide', |
| 1073 |
[ |
| 1074 |
'label' => esc_html__( 'Hide Element', 'wdk-svg-map' ), |
| 1075 |
'type' => Controls_Manager::SWITCHER, |
| 1076 |
'none' => esc_html__( 'Hide', 'wdk-svg-map' ), |
| 1077 |
'block' => esc_html__( 'Show', 'wdk-svg-map' ), |
| 1078 |
'return_value' => 'none', |
| 1079 |
'default' => ($item['key'] == 'field_button_reset' ) ? 'none':'', |
| 1080 |
'selectors' => [ |
| 1081 |
$item['selector_hide'] => 'display: {{VALUE}};', |
| 1082 |
], |
| 1083 |
] |
| 1084 |
); |
| 1085 |
} |
| 1086 |
} |
| 1087 |
|
| 1088 |
if($item['key'] !='field_slider_range'){ |
| 1089 |
$selectors = array(); |
| 1090 |
|
| 1091 |
if(!empty($item['selector'])) |
| 1092 |
$selectors['normal'] = $item['selector']; |
| 1093 |
|
| 1094 |
if(!empty($item['selector_hover'])) |
| 1095 |
$selectors['hover'] = $item['selector_hover']; |
| 1096 |
|
| 1097 |
if(!empty($item['selector_focus'])) |
| 1098 |
$selectors['focus'] = $item['selector_hover']; |
| 1099 |
|
| 1100 |
$this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); |
| 1101 |
} |
| 1102 |
|
| 1103 |
if($item['key'] =='field_text'){ |
| 1104 |
$this->add_control( |
| 1105 |
'field_text_pl_header', |
| 1106 |
[ |
| 1107 |
'label' => __( 'Placeholder', 'wpdirectorykit' ), |
| 1108 |
'type' => Controls_Manager::HEADING, |
| 1109 |
] |
| 1110 |
); |
| 1111 |
|
| 1112 |
$selectors = array( |
| 1113 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="text"]::placeholder, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field input[type="number"]::placeholder', |
| 1114 |
); |
| 1115 |
|
| 1116 |
$this->generate_renders_tabs($selectors, 'field_text_pl_dynamic', ['align','typo','color']); |
| 1117 |
} |
| 1118 |
|
| 1119 |
if($item['key'] =='field_slider_range') { |
| 1120 |
|
| 1121 |
$this->add_responsive_control( |
| 1122 |
'field_slider_range_color_circle', |
| 1123 |
[ |
| 1124 |
'label' => esc_html__( 'Circle Color', 'wpdirectorykit' ), |
| 1125 |
'type' => Controls_Manager::COLOR, |
| 1126 |
'selectors' => [ |
| 1127 |
'#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-handle' => 'border-color: {{VALUE}};', |
| 1128 |
], |
| 1129 |
] |
| 1130 |
); |
| 1131 |
|
| 1132 |
$this->add_responsive_control( |
| 1133 |
'field_slider_range_color_line', |
| 1134 |
[ |
| 1135 |
'label' => esc_html__( 'Line Color', 'wpdirectorykit' ), |
| 1136 |
'type' => Controls_Manager::COLOR, |
| 1137 |
'selectors' => [ |
| 1138 |
'#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-bar' => 'background-color: {{VALUE}};', |
| 1139 |
], |
| 1140 |
] |
| 1141 |
); |
| 1142 |
|
| 1143 |
$this->add_responsive_control( |
| 1144 |
'field_slider_range_color_label', |
| 1145 |
[ |
| 1146 |
'label' => esc_html__( 'Label Color', 'wpdirectorykit' ), |
| 1147 |
'type' => Controls_Manager::COLOR, |
| 1148 |
'selectors' => [ |
| 1149 |
'#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-from, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-to, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-single' => 'background-color: {{VALUE}};', |
| 1150 |
'#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-from::before, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-to::before, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-single::before' => 'border-top-color: {{VALUE}};', |
| 1151 |
], |
| 1152 |
] |
| 1153 |
); |
| 1154 |
|
| 1155 |
$this->add_responsive_control( |
| 1156 |
'field_slider_range_color_text_label', |
| 1157 |
[ |
| 1158 |
'label' => esc_html__( 'Label Text Color', 'wpdirectorykit' ), |
| 1159 |
'type' => Controls_Manager::COLOR, |
| 1160 |
'selectors' => [ |
| 1161 |
'#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-from, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-to, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-single' => 'color: {{VALUE}};', |
| 1162 |
], |
| 1163 |
] |
| 1164 |
); |
| 1165 |
|
| 1166 |
$this->add_group_control( |
| 1167 |
Group_Control_Typography::get_type(), |
| 1168 |
[ |
| 1169 |
'name' => 'field_slider_range_color_typo', |
| 1170 |
'selector' => '#wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-from, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-to, #wdk_search_popup_modal_'.$this->get_id().' .irs--round .irs-single', |
| 1171 |
] |
| 1172 |
); |
| 1173 |
|
| 1174 |
$this->add_responsive_control( |
| 1175 |
'field_slider_range_color_text_line', |
| 1176 |
[ |
| 1177 |
'label' => esc_html__( 'Line Text Color', 'wpdirectorykit' ), |
| 1178 |
'type' => Controls_Manager::COLOR, |
| 1179 |
'selectors' => [ |
| 1180 |
'#wdk_search_popup_modal_'.$this->get_id().' .wdk-slider-range-field .irs--round .irs-grid-text' => 'color: {{VALUE}};', |
| 1181 |
], |
| 1182 |
] |
| 1183 |
); |
| 1184 |
|
| 1185 |
} |
| 1186 |
|
| 1187 |
if($item['key'] =='field_tree') { |
| 1188 |
|
| 1189 |
$this->add_control( |
| 1190 |
'styles_field_tree_pl_hr', |
| 1191 |
[ |
| 1192 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1193 |
] |
| 1194 |
); |
| 1195 |
|
| 1196 |
$this->add_control( |
| 1197 |
'styles_field_tree_pl_header', |
| 1198 |
[ |
| 1199 |
'label' => __( 'Placeholder', 'wpdirectorykit' ), |
| 1200 |
'type' => Controls_Manager::HEADING, |
| 1201 |
] |
| 1202 |
); |
| 1203 |
|
| 1204 |
|
| 1205 |
$this->add_control( |
| 1206 |
'styles_field_tree_pl_hr2', |
| 1207 |
[ |
| 1208 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1209 |
] |
| 1210 |
); |
| 1211 |
|
| 1212 |
$selectors = array( |
| 1213 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group:not(.sel_class) button:first-child, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-search__field::placeholder,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-search__field::placeholder', |
| 1214 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group:not(.sel_class) button:first-child%1$s,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-search__field%1$s::placeholder,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-search__field%1$s::placeholder', |
| 1215 |
); |
| 1216 |
|
| 1217 |
$this->generate_renders_tabs($selectors, 'styles_field_tree_pl_list_dynamic', ['align','typo','color']); |
| 1218 |
|
| 1219 |
$this->add_control( |
| 1220 |
'styles_field_text_tree_pl_hr', |
| 1221 |
[ |
| 1222 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1223 |
] |
| 1224 |
); |
| 1225 |
|
| 1226 |
$this->add_control( |
| 1227 |
'styles_field_text_tree_pl_header', |
| 1228 |
[ |
| 1229 |
'label' => __( 'Text field', 'wpdirectorykit' ), |
| 1230 |
'type' => Controls_Manager::HEADING, |
| 1231 |
] |
| 1232 |
); |
| 1233 |
|
| 1234 |
|
| 1235 |
$this->add_control( |
| 1236 |
'styles_field_text_tree_pl_hr2', |
| 1237 |
[ |
| 1238 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1239 |
] |
| 1240 |
); |
| 1241 |
|
| 1242 |
$selectors = array( |
| 1243 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group button, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-search__field,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-search__field', |
| 1244 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .btn-group%1$s button,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-search__field%1$s,#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-search__field%1$s', |
| 1245 |
); |
| 1246 |
|
| 1247 |
$this->generate_renders_tabs($selectors, 'styles_field_text_tree_pl_list_dynamic', ['typo','color']); |
| 1248 |
|
| 1249 |
|
| 1250 |
$this->add_control( |
| 1251 |
'styles_field_tree_hr', |
| 1252 |
[ |
| 1253 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1254 |
] |
| 1255 |
); |
| 1256 |
|
| 1257 |
$this->add_control( |
| 1258 |
'styles_field_tree_header', |
| 1259 |
[ |
| 1260 |
'label' => __( 'List Items', 'wpdirectorykit' ), |
| 1261 |
'type' => Controls_Manager::HEADING, |
| 1262 |
] |
| 1263 |
); |
| 1264 |
|
| 1265 |
|
| 1266 |
$this->add_control( |
| 1267 |
'styles_field_tree_hr2', |
| 1268 |
[ |
| 1269 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1270 |
] |
| 1271 |
); |
| 1272 |
|
| 1273 |
$selectors = array( |
| 1274 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .list_scroll ul li, .select_multi_dropdown_tree .select2-dropdown .select2-results__options .select2-results__option', |
| 1275 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk_dropdown_tree .list_scroll ul li, .select_multi_dropdown_tree .select2-dropdown .select2-results__options .select2-results__option%1$s', |
| 1276 |
); |
| 1277 |
|
| 1278 |
$this->generate_renders_tabs($selectors, 'styles_field_tree_list_dynamic', ['margin','align','typo','color','background','border','padding','transition']); |
| 1279 |
|
| 1280 |
if(wdk_get_option('wdk_multi_categories_search_field_type')=='select2' || wdk_get_option('wdk_multi_locations_search_field_type')=='select2' ) { |
| 1281 |
$this->add_control( |
| 1282 |
'styles_field_tree_items_hr', |
| 1283 |
[ |
| 1284 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1285 |
] |
| 1286 |
); |
| 1287 |
|
| 1288 |
$this->add_control( |
| 1289 |
'styles_field_tree_items_header', |
| 1290 |
[ |
| 1291 |
'label' => __( 'Multi Items for Multiple Dropdowns', 'wpdirectorykit' ), |
| 1292 |
'type' => Controls_Manager::HEADING, |
| 1293 |
] |
| 1294 |
); |
| 1295 |
|
| 1296 |
|
| 1297 |
$this->add_control( |
| 1298 |
'styles_field_tree_items_hr2', |
| 1299 |
[ |
| 1300 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1301 |
] |
| 1302 |
); |
| 1303 |
|
| 1304 |
$selectors = array( |
| 1305 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-selection__choice, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-selection__choice', |
| 1306 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.CATEGORY .select2 .select2-selection__choice%1$s, #wdk_search_popup_modal_'.$this->get_id().' .wdk-field.LOCATION .select2 .select2-selection__choice%1$s', |
| 1307 |
); |
| 1308 |
|
| 1309 |
$this->generate_renders_tabs($selectors, 'styles_field_tree_list_items_dynamic', ['margin','typo','color','background','border','border_radius','padding','transition']); |
| 1310 |
} |
| 1311 |
} |
| 1312 |
|
| 1313 |
if($item['key'] =='field_select2') { |
| 1314 |
|
| 1315 |
$this->add_control( |
| 1316 |
'styles_field_select2_pl_hr', |
| 1317 |
[ |
| 1318 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1319 |
] |
| 1320 |
); |
| 1321 |
|
| 1322 |
$this->add_control( |
| 1323 |
'styles_field_select2_pl_header', |
| 1324 |
[ |
| 1325 |
'label' => __( 'Placeholder', 'wpdirectorykit' ), |
| 1326 |
'type' => Controls_Manager::HEADING, |
| 1327 |
] |
| 1328 |
); |
| 1329 |
|
| 1330 |
|
| 1331 |
$this->add_control( |
| 1332 |
'styles_field_select2_pl_hr2', |
| 1333 |
[ |
| 1334 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1335 |
] |
| 1336 |
); |
| 1337 |
|
| 1338 |
$selectors = array( |
| 1339 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2 .select2-search__field::placeholder', |
| 1340 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2 .select2-search__field%1$s::placeholder', |
| 1341 |
); |
| 1342 |
|
| 1343 |
$this->generate_renders_tabs($selectors, 'styles_field_select2_pl_list_dynamic', ['align','typo','color']); |
| 1344 |
|
| 1345 |
$this->add_control( |
| 1346 |
'styles_field_select2_hr', |
| 1347 |
[ |
| 1348 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1349 |
] |
| 1350 |
); |
| 1351 |
|
| 1352 |
$this->add_control( |
| 1353 |
'styles_field_select2_header', |
| 1354 |
[ |
| 1355 |
'label' => __( 'List Items', 'wpdirectorykit' ), |
| 1356 |
'type' => Controls_Manager::HEADING, |
| 1357 |
] |
| 1358 |
); |
| 1359 |
|
| 1360 |
|
| 1361 |
$this->add_control( |
| 1362 |
'styles_field_select2_hr2', |
| 1363 |
[ |
| 1364 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1365 |
] |
| 1366 |
); |
| 1367 |
|
| 1368 |
|
| 1369 |
$selectors = array( |
| 1370 |
'normal' => '.select_multi_dropdown .select2-dropdown .select2-results__options .select2-results__option', |
| 1371 |
'hover'=>'.select_multi_dropdown .select2-dropdown .select2-results__options .select2-results__option%1$s', |
| 1372 |
); |
| 1373 |
|
| 1374 |
$this->generate_renders_tabs($selectors, 'styles_field_select2_list_dynamic', ['margin','align','typo','color','background','border','padding','transition']); |
| 1375 |
|
| 1376 |
$this->add_control( |
| 1377 |
'styles_field_select2_items_hr', |
| 1378 |
[ |
| 1379 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1380 |
] |
| 1381 |
); |
| 1382 |
|
| 1383 |
$this->add_control( |
| 1384 |
'styles_field_select2_items_header', |
| 1385 |
[ |
| 1386 |
'label' => __( 'Multi Items', 'wpdirectorykit' ), |
| 1387 |
'type' => Controls_Manager::HEADING, |
| 1388 |
] |
| 1389 |
); |
| 1390 |
|
| 1391 |
|
| 1392 |
$this->add_control( |
| 1393 |
'styles_field_select2_items_hr2', |
| 1394 |
[ |
| 1395 |
'type' => \Elementor\Controls_Manager::DIVIDER, |
| 1396 |
] |
| 1397 |
); |
| 1398 |
|
| 1399 |
$selectors = array( |
| 1400 |
'normal' => '#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2 .select2-selection__choice', |
| 1401 |
'hover'=>'#wdk_search_popup_modal_'.$this->get_id().' .wdk-field.DROPDOWNMULTIPLE .select2 .select2-selection__choice%1$s', |
| 1402 |
); |
| 1403 |
|
| 1404 |
$this->generate_renders_tabs($selectors, 'styles_field_select2_list_items_dynamic', ['margin','typo','color','background','border','border_radius','padding','transition']); |
| 1405 |
|
| 1406 |
} |
| 1407 |
|
| 1408 |
$this->end_controls_section(); |
| 1409 |
/* END special for some elements */ |
| 1410 |
|
| 1411 |
} |
| 1412 |
} |
| 1413 |
|
| 1414 |
private function generate_controls_content() { |
| 1415 |
|
| 1416 |
} |
| 1417 |
|
| 1418 |
public function enqueue_styles_scripts() { |
| 1419 |
wp_enqueue_style('wdk-search-popup'); |
| 1420 |
wp_enqueue_style('slick'); |
| 1421 |
wp_enqueue_style('wdk-suggestion'); |
| 1422 |
wp_enqueue_style('slick-theme'); |
| 1423 |
wp_enqueue_script('slick'); |
| 1424 |
wp_enqueue_script('wdk-treefield'); |
| 1425 |
wp_enqueue_script('wdk-suggestion'); |
| 1426 |
wp_enqueue_style('wdk-treefield'); |
| 1427 |
|
| 1428 |
wp_enqueue_script('wdk-modal'); |
| 1429 |
wp_enqueue_style('wdk-modal'); |
| 1430 |
|
| 1431 |
wp_enqueue_script('select2'); |
| 1432 |
wp_enqueue_script('wdk-select2'); |
| 1433 |
wp_enqueue_style('select2'); |
| 1434 |
|
| 1435 |
wp_enqueue_script( 'ion.range-slider' ); |
| 1436 |
wp_enqueue_style('ion.range-slider'); |
| 1437 |
wp_enqueue_style('wdk-slider-range'); |
| 1438 |
wp_enqueue_script('wdk-slider-range'); |
| 1439 |
|
| 1440 |
wp_enqueue_style( 'wdk-treefield-checkboxes'); |
| 1441 |
wp_enqueue_script( 'wdk-treefield-checkboxes'); |
| 1442 |
} |
| 1443 |
} |
| 1444 |
|