| 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 WdkListingsCarousel 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__('Layout', 'wpdirectorykit') |
| 37 |
); |
| 38 |
|
| 39 |
\Elementor\Controls_Manager::add_tab( |
| 40 |
'tab_content', |
| 41 |
esc_html__('Main', 'wpdirectorykit') |
| 42 |
); |
| 43 |
|
| 44 |
if ($this->is_edit_mode_load()) { |
| 45 |
$this->enqueue_styles_scripts(); |
| 46 |
} |
| 47 |
|
| 48 |
parent::__construct($data, $args); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Retrieve the widget name. |
| 53 |
* |
| 54 |
* @since 1.1.0 |
| 55 |
* |
| 56 |
* @access public |
| 57 |
* |
| 58 |
* @return string Widget name. |
| 59 |
*/ |
| 60 |
public function get_name() { |
| 61 |
return 'wdk-listings-carousel'; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Retrieve the widget title. |
| 66 |
* |
| 67 |
* @since 1.1.0 |
| 68 |
* |
| 69 |
* @access public |
| 70 |
* |
| 71 |
* @return string Widget title. |
| 72 |
*/ |
| 73 |
public function get_title() { |
| 74 |
return esc_html__('Wdk Listings Carousel', 'wpdirectorykit'); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Retrieve the widget icon. |
| 79 |
* |
| 80 |
* @since 1.1.0 |
| 81 |
* |
| 82 |
* @access public |
| 83 |
* |
| 84 |
* @return string Widget icon. |
| 85 |
*/ |
| 86 |
public function get_icon() { |
| 87 |
return 'eicon-post-navigation'; |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Register the widget controls. |
| 92 |
* |
| 93 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 94 |
* |
| 95 |
* @since 1.1.0 |
| 96 |
* |
| 97 |
* @access protected |
| 98 |
*/ |
| 99 |
protected function register_controls() { |
| 100 |
$this->generate_controls_conf(); |
| 101 |
$this->generate_controls_layout(); |
| 102 |
$this->generate_controls_styles(); |
| 103 |
$this->generate_controls_content(); |
| 104 |
|
| 105 |
$this->insert_pro_message('tab_conf'); |
| 106 |
parent::register_controls(); |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Render the widget output on the frontend. |
| 111 |
* |
| 112 |
* Written in PHP and used to generate the final HTML. |
| 113 |
* |
| 114 |
* @since 1.1.0 |
| 115 |
* |
| 116 |
* @access protected |
| 117 |
*/ |
| 118 |
protected function render() { |
| 119 |
parent::render(); |
| 120 |
$this->data['id_element'] = $this->get_id(); |
| 121 |
$this->data['settings'] = $this->get_settings(); |
| 122 |
|
| 123 |
$this->data['listings_count'] = 0; |
| 124 |
$this->data['results'] = array(); |
| 125 |
$this->data['pagination_output'] = ''; |
| 126 |
$columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by', 'is_featured', 'address'); |
| 127 |
$custom_parameters = array(); |
| 128 |
|
| 129 |
if($this->data['settings']['conf_results_type'] == 'results_listings') { |
| 130 |
$controller = 'listing'; |
| 131 |
$offset = NULL; |
| 132 |
|
| 133 |
if(!isset($custom_parameters['order_by'])) { |
| 134 |
$custom_parameters['order_by'] = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; |
| 135 |
} |
| 136 |
|
| 137 |
if(!isset($custom_parameters['conf_order_by_custom'])) { |
| 138 |
$custom_parameters['order_by'] = $this->data['settings']['conf_order_by_custom'].' '.$this->data['settings']['conf_order']; |
| 139 |
} |
| 140 |
|
| 141 |
if(!empty($this->data['settings']['conf_query'])) { |
| 142 |
$qr_string = trim($this->data['settings']['conf_query'],'?'); |
| 143 |
$string_par = array(); |
| 144 |
parse_str($qr_string, $string_par); |
| 145 |
$custom_parameters += array_map('trim', $string_par); |
| 146 |
} |
| 147 |
|
| 148 |
if($this->data['settings']['only_is_featured'] == 'yes') { |
| 149 |
$custom_parameters['is_featured'] = 'on'; |
| 150 |
} |
| 151 |
$external_columns = array('location_id', 'category_id', 'post_title', 'is_featured'); |
| 152 |
|
| 153 |
wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, TRUE); |
| 154 |
$this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['conf_limit'], $offset, array('is_activated' => 1,'is_approved'=>1)); |
| 155 |
|
| 156 |
} else if($this->data['settings']['conf_results_type'] == 'custom_listings') { |
| 157 |
$listings_ids = array(); |
| 158 |
foreach($this->data['settings']['conf_custom_results'] as $listing) { |
| 159 |
if(isset($listing['listing_post_id']) && !empty($listing['listing_post_id'])) { |
| 160 |
$listings_ids [] = $listing['listing_post_id']; |
| 161 |
} |
| 162 |
} |
| 163 |
/* where in */ |
| 164 |
if(!empty($listings_ids)){ |
| 165 |
$this->WMVC->db->where( $this->WMVC->db->prefix.'wdk_listings.post_id IN(' . implode(',', $listings_ids) . ')', null, false); |
| 166 |
$this->WMVC->db->where(array('is_activated' => 1)); |
| 167 |
$this->WMVC->db->order_by('FIELD('.$this->WMVC->db->prefix.'wdk_listings.post_id, '. implode(',', $listings_ids) . ')'); |
| 168 |
$this->data['results'] = $this->WMVC->listing_m->get(); |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
if(!empty($this->data['results']) && $this->data['listings_count'] == 0) |
| 173 |
$this->data['listings_count'] = wmvc_count($this->data['results']); |
| 174 |
|
| 175 |
$this->data['settings']['content_button_icon'] = $this->generate_icon($this->data['settings']['content_button_icon']); |
| 176 |
$this->data['is_edit_mode'] = false; |
| 177 |
if(Plugin::$instance->editor->is_edit_mode()) |
| 178 |
$this->data['is_edit_mode'] = true; |
| 179 |
|
| 180 |
echo $this->view('wdk-listings-carousel', $this->data); |
| 181 |
|
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
private function generate_controls_conf() { |
| 186 |
$this->start_controls_section( |
| 187 |
'tab_conf_main_section', |
| 188 |
[ |
| 189 |
'label' => esc_html__('Main', 'wpdirectorykit'), |
| 190 |
'tab' => 'tab_conf', |
| 191 |
] |
| 192 |
); |
| 193 |
|
| 194 |
$this->add_control( |
| 195 |
'conf_results_type', |
| 196 |
[ |
| 197 |
'label' => __( 'Carousel type', 'wpdirectorykit' ), |
| 198 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 199 |
'default' => 'results_listings', |
| 200 |
'options' => [ |
| 201 |
'results_listings' => __( 'Results Listings', 'wpdirectorykit' ), |
| 202 |
'custom_listings' => __( 'Specific Listings', 'wpdirectorykit' ), |
| 203 |
], |
| 204 |
'separator' => 'after', |
| 205 |
] |
| 206 |
); |
| 207 |
|
| 208 |
$this->add_control( |
| 209 |
'important_note', |
| 210 |
[ |
| 211 |
'label' => '', |
| 212 |
'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 213 |
'raw' => wdk_sprintf(__( 'Edit Result Card Designer <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_resultitem')), |
| 214 |
'content_classes' => 'wdk_elementor_hint', |
| 215 |
'separator' => 'after', |
| 216 |
] |
| 217 |
); |
| 218 |
|
| 219 |
$this->add_control( |
| 220 |
'important_note2', |
| 221 |
[ |
| 222 |
'label' => '', |
| 223 |
'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 224 |
'raw' => wdk_sprintf(__( 'Manage Listings <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk')), |
| 225 |
'content_classes' => 'wdk_elementor_hint', |
| 226 |
'separator' => 'after', |
| 227 |
] |
| 228 |
); |
| 229 |
|
| 230 |
/* conf_results_type :: results_listings */ |
| 231 |
if(true){ |
| 232 |
$this->add_control( |
| 233 |
'conf_results_type_results_listings_header', |
| 234 |
[ |
| 235 |
'label' => esc_html__('Results listings', 'wpdirectorykit'), |
| 236 |
'type' => Controls_Manager::HEADING, |
| 237 |
'separator' => 'before', |
| 238 |
'conditions' => [ |
| 239 |
'terms' => [ |
| 240 |
[ |
| 241 |
'name' => 'conf_results_type', |
| 242 |
'operator' => '==', |
| 243 |
'value' => 'results_listings', |
| 244 |
] |
| 245 |
], |
| 246 |
], |
| 247 |
] |
| 248 |
); |
| 249 |
|
| 250 |
$this->add_control( |
| 251 |
'conf_limit', |
| 252 |
[ |
| 253 |
'label' => __( 'Limit Results', 'wpdirectorykit' ), |
| 254 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 255 |
'min' => 1, |
| 256 |
'max' => 250, |
| 257 |
'step' => 1, |
| 258 |
'default' => 6, |
| 259 |
'conditions' => [ |
| 260 |
'terms' => [ |
| 261 |
[ |
| 262 |
'name' => 'conf_results_type', |
| 263 |
'operator' => '==', |
| 264 |
'value' => 'results_listings', |
| 265 |
] |
| 266 |
], |
| 267 |
], |
| 268 |
] |
| 269 |
); |
| 270 |
|
| 271 |
$this->add_control( |
| 272 |
'only_is_featured', |
| 273 |
[ |
| 274 |
'label' => __( 'Only show featured', 'wpdirectorykit' ), |
| 275 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 276 |
'label_on' => __( 'True', 'wpdirectorykit' ), |
| 277 |
'label_off' => __( 'False', 'wpdirectorykit' ), |
| 278 |
'return_value' => 'yes', |
| 279 |
'default' => '', |
| 280 |
] |
| 281 |
); |
| 282 |
|
| 283 |
$this->add_control( |
| 284 |
'conf_query', |
| 285 |
[ |
| 286 |
'label' => __( 'Query', 'wpdirectorykit' ), |
| 287 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 288 |
'rows' => 5, |
| 289 |
'default' => '', |
| 290 |
'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ), |
| 291 |
'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url):', 'wpdirectorykit' ). |
| 292 |
' field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4&search_agents_ids=3'. |
| 293 |
'</span>', |
| 294 |
'conditions' => [ |
| 295 |
'terms' => [ |
| 296 |
[ |
| 297 |
'name' => 'conf_results_type', |
| 298 |
'operator' => '==', |
| 299 |
'value' => 'results_listings', |
| 300 |
] |
| 301 |
], |
| 302 |
], |
| 303 |
] |
| 304 |
); |
| 305 |
|
| 306 |
$this->add_control( |
| 307 |
'conf_order_by', |
| 308 |
[ |
| 309 |
'label' => __('Default Sort By Column', 'wpdirectorykit'), |
| 310 |
'type' => Controls_Manager::SELECT, |
| 311 |
'label_block' => true, |
| 312 |
'options' => [ |
| 313 |
'none' => __('None', 'wpdirectorykit'), |
| 314 |
'post_id' => __('ID', 'wpdirectorykit'), |
| 315 |
'post_title' => __('Title', 'wpdirectorykit'), |
| 316 |
], |
| 317 |
'default' => 'post_id', |
| 318 |
'conditions' => [ |
| 319 |
'terms' => [ |
| 320 |
[ |
| 321 |
'name' => 'conf_results_type', |
| 322 |
'operator' => '==', |
| 323 |
'value' => 'results_listings', |
| 324 |
] |
| 325 |
], |
| 326 |
], |
| 327 |
] |
| 328 |
); |
| 329 |
|
| 330 |
$this->add_control( |
| 331 |
'conf_order_by_custom', |
| 332 |
[ |
| 333 |
'label' => __('Default Custom Sort By (Column)', 'wpdirectorykit'), |
| 334 |
'description' => '<span style="word-break: break-all;">'.__( 'Example:', 'wpdirectorykit' ). |
| 335 |
'<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'. |
| 336 |
'<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'. |
| 337 |
'<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'. |
| 338 |
'<br> category_title - Category Title'. |
| 339 |
'<br> location_title - Location Title'. |
| 340 |
'</span>', |
| 341 |
'type' => Controls_Manager::TEXT, |
| 342 |
'label_block' => true, |
| 343 |
'default' => 'post_id', |
| 344 |
'conditions' => [ |
| 345 |
'terms' => [ |
| 346 |
[ |
| 347 |
'name' => 'conf_results_type', |
| 348 |
'operator' => '==', |
| 349 |
'value' => 'results_listings', |
| 350 |
] |
| 351 |
], |
| 352 |
], |
| 353 |
] |
| 354 |
); |
| 355 |
|
| 356 |
$this->add_control( |
| 357 |
'conf_order', |
| 358 |
[ |
| 359 |
'label' => __('Default Post Order', 'wpdirectorykit'), |
| 360 |
'type' => Controls_Manager::SELECT, |
| 361 |
'label_block' => true, |
| 362 |
'options' => [ |
| 363 |
'asc' => __('Ascending', 'wpdirectorykit'), |
| 364 |
'desc' => __('Descending', 'wpdirectorykit') |
| 365 |
], |
| 366 |
'default' => 'desc', |
| 367 |
'conditions' => [ |
| 368 |
'terms' => [ |
| 369 |
[ |
| 370 |
'name' => 'conf_results_type', |
| 371 |
'operator' => '==', |
| 372 |
'value' => 'results_listings', |
| 373 |
] |
| 374 |
], |
| 375 |
], |
| 376 |
] |
| 377 |
); |
| 378 |
|
| 379 |
|
| 380 |
} |
| 381 |
|
| 382 |
if(true) { |
| 383 |
$this->add_control( |
| 384 |
'conf_results_type_custom_listings_header', |
| 385 |
[ |
| 386 |
'label' => esc_html__('Custom listings', 'wpdirectorykit'), |
| 387 |
'type' => Controls_Manager::HEADING, |
| 388 |
'separator' => 'before', |
| 389 |
'conditions' => [ |
| 390 |
'terms' => [ |
| 391 |
[ |
| 392 |
'name' => 'conf_results_type', |
| 393 |
'operator' => '==', |
| 394 |
'value' => 'custom_listings', |
| 395 |
] |
| 396 |
], |
| 397 |
], |
| 398 |
] |
| 399 |
); |
| 400 |
|
| 401 |
|
| 402 |
if(true){ |
| 403 |
$repeater = new Repeater(); |
| 404 |
$repeater->start_controls_tabs( 'listings' ); |
| 405 |
$repeater->add_control( |
| 406 |
'listing_post_id', |
| 407 |
[ |
| 408 |
'label' => __( 'ID Post Listing', 'wpdirectorykit' ), |
| 409 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 410 |
'min' => 1, |
| 411 |
'step' => 1, |
| 412 |
] |
| 413 |
); |
| 414 |
$repeater->end_controls_tabs(); |
| 415 |
|
| 416 |
|
| 417 |
$this->add_control( |
| 418 |
'conf_custom_results', |
| 419 |
[ |
| 420 |
'type' => Controls_Manager::REPEATER, |
| 421 |
'fields' => $repeater->get_controls(), |
| 422 |
'default' => [ |
| 423 |
], |
| 424 |
'title_field' => '{{{ listing_post_id }}}', |
| 425 |
'conditions' => [ |
| 426 |
'terms' => [ |
| 427 |
[ |
| 428 |
'name' => 'conf_results_type', |
| 429 |
'operator' => '==', |
| 430 |
'value' => 'custom_listings', |
| 431 |
] |
| 432 |
], |
| 433 |
], |
| 434 |
] |
| 435 |
); |
| 436 |
|
| 437 |
} |
| 438 |
} |
| 439 |
|
| 440 |
$this->end_controls_section(); |
| 441 |
|
| 442 |
} |
| 443 |
|
| 444 |
private function generate_controls_layout() { |
| 445 |
$this->start_controls_section( |
| 446 |
'tab_content', |
| 447 |
[ |
| 448 |
'label' => esc_html__('Basic', 'wpdirectorykit'), |
| 449 |
'tab' => 'tab_layout', |
| 450 |
] |
| 451 |
); |
| 452 |
|
| 453 |
/* Carousel Grid Config */ |
| 454 |
if(true) { |
| 455 |
$this->add_responsive_control( |
| 456 |
'carousel_column_gap_carousel', |
| 457 |
[ |
| 458 |
'label' => esc_html__('Slider Gap', 'wpdirectorykit'), |
| 459 |
'type' => Controls_Manager::SLIDER, |
| 460 |
'range' => [ |
| 461 |
'px' => [ |
| 462 |
'min' => 0, |
| 463 |
'max' => 60, |
| 464 |
], |
| 465 |
], |
| 466 |
'selectors' => [ |
| 467 |
'{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini ' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};', |
| 468 |
], |
| 469 |
] |
| 470 |
); |
| 471 |
|
| 472 |
$this->add_responsive_control ( |
| 473 |
'carousel_column_gap', |
| 474 |
[ |
| 475 |
'label' => esc_html__('Columns Gap', 'wpdirectorykit'), |
| 476 |
'type' => Controls_Manager::SLIDER, |
| 477 |
'default' => [ |
| 478 |
'size' => 10, |
| 479 |
], |
| 480 |
'range' => [ |
| 481 |
'px' => [ |
| 482 |
'min' => 0, |
| 483 |
'max' => 60, |
| 484 |
], |
| 485 |
], |
| 486 |
'selectors' => [ |
| 487 |
'{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};', |
| 488 |
'{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};', |
| 489 |
], |
| 490 |
] |
| 491 |
); |
| 492 |
|
| 493 |
$this->add_responsive_control( |
| 494 |
'carousel_column_gap_top', |
| 495 |
[ |
| 496 |
'label' => esc_html__('Columns Gap Top', 'wpdirectorykit'), |
| 497 |
'type' => Controls_Manager::SLIDER, |
| 498 |
'default' => [ |
| 499 |
'size' => 0, |
| 500 |
], |
| 501 |
'range' => [ |
| 502 |
'px' => [ |
| 503 |
'min' => 0, |
| 504 |
'max' => 60, |
| 505 |
], |
| 506 |
], |
| 507 |
'selectors' => [ |
| 508 |
'{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-top: {{SIZE}}{{UNIT}};', |
| 509 |
], |
| 510 |
] |
| 511 |
); |
| 512 |
|
| 513 |
$this->add_responsive_control( |
| 514 |
'carousel_column_gap_bottom', |
| 515 |
[ |
| 516 |
'label' => esc_html__('Columns Gap Bottom', 'wpdirectorykit'), |
| 517 |
'type' => Controls_Manager::SLIDER, |
| 518 |
'default' => [ |
| 519 |
'size' => 10, |
| 520 |
], |
| 521 |
'range' => [ |
| 522 |
'px' => [ |
| 523 |
'min' => 0, |
| 524 |
'max' => 60, |
| 525 |
], |
| 526 |
], |
| 527 |
'selectors' => [ |
| 528 |
'{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-bottom: {{SIZE}}{{UNIT}};', |
| 529 |
], |
| 530 |
] |
| 531 |
); |
| 532 |
} |
| 533 |
|
| 534 |
|
| 535 |
$this->add_control( |
| 536 |
'basic_el_header_1', |
| 537 |
[ |
| 538 |
'label' => esc_html__('Text', 'wpdirectorykit'), |
| 539 |
'type' => Controls_Manager::HEADING, |
| 540 |
'separator' => 'before', |
| 541 |
] |
| 542 |
); |
| 543 |
|
| 544 |
$this->add_control( |
| 545 |
'content_button_text', |
| 546 |
[ |
| 547 |
'label' => __( 'Button Open Text', 'wpdirectorykit' ), |
| 548 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 549 |
'default' => '', |
| 550 |
] |
| 551 |
); |
| 552 |
|
| 553 |
$this->end_controls_section(); |
| 554 |
|
| 555 |
$this->start_controls_section( |
| 556 |
'layout_carousel_sec', |
| 557 |
[ |
| 558 |
'label' => esc_html__('Carousel Options', 'wpdirectorykit'), |
| 559 |
'tab' => 'tab_layout', |
| 560 |
] |
| 561 |
); |
| 562 |
|
| 563 |
$this->add_control( |
| 564 |
'layout_carousel_is_infinite', |
| 565 |
[ |
| 566 |
'label' => __( 'Infinite', 'wpdirectorykit' ), |
| 567 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 568 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 569 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 570 |
'return_value' => 'true', |
| 571 |
'default' => 'true', |
| 572 |
] |
| 573 |
); |
| 574 |
|
| 575 |
$this->add_control( |
| 576 |
'layout_carousel_is_autoplay', |
| 577 |
[ |
| 578 |
'label' => __( 'Autoplay', 'wpdirectorykit' ), |
| 579 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 580 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 581 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 582 |
'return_value' => 'true', |
| 583 |
'default' => '', |
| 584 |
] |
| 585 |
); |
| 586 |
|
| 587 |
$this->add_control( |
| 588 |
'layout_carousel_speed', |
| 589 |
[ |
| 590 |
'label' => __( 'Speed', 'wpdirectorykit' ), |
| 591 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 592 |
'min' => 0, |
| 593 |
'max' => 100000, |
| 594 |
'step' => 100, |
| 595 |
'default' => 500, |
| 596 |
] |
| 597 |
); |
| 598 |
|
| 599 |
$this->add_control( |
| 600 |
'layout_carousel_animation_style', |
| 601 |
[ |
| 602 |
'label' => __( 'Animation Style', 'wpdirectorykit' ), |
| 603 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 604 |
'default' => 'fade', |
| 605 |
'options' => [ |
| 606 |
'slide' => __( 'Slide', 'wpdirectorykit' ), |
| 607 |
'fade' => __( 'Fade', 'wpdirectorykit' ), |
| 608 |
'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ), |
| 609 |
], |
| 610 |
] |
| 611 |
); |
| 612 |
|
| 613 |
$this->add_control( |
| 614 |
'layout_carousel_cssease', |
| 615 |
[ |
| 616 |
'label' => __( 'cssEase', 'wpdirectorykit' ), |
| 617 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 618 |
'default' => 'linear', |
| 619 |
'options' => [ |
| 620 |
'linear' => __( 'linear', 'wpdirectorykit' ), |
| 621 |
'ease' => __( 'ease', 'wpdirectorykit' ), |
| 622 |
'ease-in' => __( 'ease-in', 'wpdirectorykit' ), |
| 623 |
'ease-out' => __( 'ease-out', 'wpdirectorykit' ), |
| 624 |
'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ), |
| 625 |
'step-start' => __( 'step-start', 'wpdirectorykit' ), |
| 626 |
'step-end' => __( 'step-end', 'wpdirectorykit' ), |
| 627 |
], |
| 628 |
] |
| 629 |
); |
| 630 |
|
| 631 |
$this->add_responsive_control( |
| 632 |
'layout_carousel_columns', |
| 633 |
[ |
| 634 |
'label' => __( 'Count grid', 'wpdirectorykit' ), |
| 635 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 636 |
'min' => 1, |
| 637 |
'max' => 10, |
| 638 |
'step' => 1, |
| 639 |
'default' => 3, |
| 640 |
] |
| 641 |
); |
| 642 |
|
| 643 |
$this->end_controls_section(); |
| 644 |
|
| 645 |
} |
| 646 |
|
| 647 |
private function generate_controls_styles() { |
| 648 |
$this->start_controls_section( |
| 649 |
'sstyles_thmbn_section', |
| 650 |
[ |
| 651 |
'label' => esc_html__('Section Image', 'wpdirectorykit'), |
| 652 |
'tab' => Controls_Manager::TAB_STYLE, |
| 653 |
] |
| 654 |
); |
| 655 |
|
| 656 |
$this->add_responsive_control( |
| 657 |
'styles_thmbn_des_type', |
| 658 |
[ |
| 659 |
'label' => __( 'Design type', 'wpdirectorykit' ), |
| 660 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 661 |
'default' => 'wdk_size_image_cover', |
| 662 |
'options' => [ |
| 663 |
'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ), |
| 664 |
'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ), |
| 665 |
], |
| 666 |
] |
| 667 |
); |
| 668 |
|
| 669 |
$this->add_responsive_control( |
| 670 |
'styles_thmbn_des_height', |
| 671 |
[ |
| 672 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 673 |
'type' => Controls_Manager::SLIDER, |
| 674 |
'range' => [ |
| 675 |
'px' => [ |
| 676 |
'min' => 300, |
| 677 |
'max' => 1500, |
| 678 |
], |
| 679 |
'vw' => [ |
| 680 |
'min' => 0, |
| 681 |
'max' => 100, |
| 682 |
], |
| 683 |
], |
| 684 |
'size_units' => [ 'px', 'vw' ], |
| 685 |
'default' => [ |
| 686 |
'size' => 350, |
| 687 |
'unit' => 'px', |
| 688 |
], |
| 689 |
'selectors' => [ |
| 690 |
'{{WRAPPER}} .wdk-listings-results.wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}', |
| 691 |
], |
| 692 |
'separator' => 'after', |
| 693 |
'conditions' => [ |
| 694 |
'relation' => 'or', |
| 695 |
'terms' => [ |
| 696 |
[ |
| 697 |
'name' => 'styles_thmbn_des_type', |
| 698 |
'operator' => '==', |
| 699 |
'value' => 'wdk_size_image_cover', |
| 700 |
], |
| 701 |
[ |
| 702 |
'name' => 'styles_thmbn_des_type', |
| 703 |
'operator' => '==', |
| 704 |
'value' => 'wdk_image_cover', |
| 705 |
] |
| 706 |
], |
| 707 |
] |
| 708 |
] |
| 709 |
); |
| 710 |
$this->end_controls_section(); |
| 711 |
|
| 712 |
$this->start_controls_section( |
| 713 |
'styles_carousel_arrows_section', |
| 714 |
[ |
| 715 |
'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'), |
| 716 |
'tab' => Controls_Manager::TAB_STYLE, |
| 717 |
] |
| 718 |
); |
| 719 |
|
| 720 |
$this->add_responsive_control( |
| 721 |
'styles_carousel_arrows_hide', |
| 722 |
[ |
| 723 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 724 |
'type' => Controls_Manager::SWITCHER, |
| 725 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 726 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 727 |
'return_value' => 'none', |
| 728 |
'default' => '', |
| 729 |
'selectors' => [ |
| 730 |
'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};', |
| 731 |
], |
| 732 |
] |
| 733 |
); |
| 734 |
|
| 735 |
$this->add_responsive_control( |
| 736 |
'styles_carousel_arrows_position', |
| 737 |
[ |
| 738 |
'label' => __( 'Position', 'wpdirectorykit' ), |
| 739 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 740 |
'default' => 'wdk_slider_arrows_bottom', |
| 741 |
'options' => [ |
| 742 |
'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ), |
| 743 |
'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ), |
| 744 |
'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ), |
| 745 |
], |
| 746 |
] |
| 747 |
); |
| 748 |
|
| 749 |
$this->add_responsive_control( |
| 750 |
'styles_carousel_arrows_align', |
| 751 |
[ |
| 752 |
'label' => __( 'Align', 'wpdirectorykit' ), |
| 753 |
'type' => Controls_Manager::CHOOSE, |
| 754 |
'options' => [ |
| 755 |
'left' => [ |
| 756 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 757 |
'icon' => 'eicon-text-align-left', |
| 758 |
], |
| 759 |
'center' => [ |
| 760 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 761 |
'icon' => 'eicon-text-align-center', |
| 762 |
], |
| 763 |
'right' => [ |
| 764 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 765 |
'icon' => 'eicon-text-align-right', |
| 766 |
], |
| 767 |
'justify' => [ |
| 768 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 769 |
'icon' => 'eicon-text-align-justify', |
| 770 |
], |
| 771 |
], |
| 772 |
'render_type' => 'ui', |
| 773 |
'selectors_dictionary' => [ |
| 774 |
'left' => 'justify-content: flex-start;', |
| 775 |
'center' => 'justify-content: center;', |
| 776 |
'right' => 'justify-content: flex-end;', |
| 777 |
'justify' => 'justify-content: space-between;', |
| 778 |
], |
| 779 |
'selectors' => [ |
| 780 |
'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};', |
| 781 |
], |
| 782 |
'conditions' => [ |
| 783 |
'relation' => 'or', |
| 784 |
'terms' => [ |
| 785 |
[ |
| 786 |
'name' => 'styles_thmbn_des_type', |
| 787 |
'operator' => '==', |
| 788 |
'value' => 'wdk_size_image_cover', |
| 789 |
], |
| 790 |
[ |
| 791 |
'name' => 'styles_thmbn_des_type', |
| 792 |
'operator' => '==', |
| 793 |
'value' => 'wdk_image_cover', |
| 794 |
] |
| 795 |
], |
| 796 |
], |
| 797 |
] |
| 798 |
); |
| 799 |
|
| 800 |
$this->add_responsive_control( |
| 801 |
'styles_carousel_arrows_icon_left_h', |
| 802 |
[ |
| 803 |
'label' => esc_html__('Arrow left', 'wpdirectorykit'), |
| 804 |
'type' => Controls_Manager::HEADING, |
| 805 |
'separator' => 'before', |
| 806 |
] |
| 807 |
); |
| 808 |
$this->add_responsive_control( |
| 809 |
'styles_carousel_arrows_s_m_left_margin', |
| 810 |
[ |
| 811 |
'label' => esc_html__( 'Margin', 'wpdirectorykit' ), |
| 812 |
'type' => Controls_Manager::DIMENSIONS, |
| 813 |
'size_units' => [ 'px', 'em', '%' ], |
| 814 |
'allowed_dimensions' => 'horizontal', |
| 815 |
'selectors' => [ |
| 816 |
'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};', |
| 817 |
], |
| 818 |
] |
| 819 |
); |
| 820 |
|
| 821 |
$this->add_responsive_control( |
| 822 |
'styles_carousel_arrows_icon_left', |
| 823 |
[ |
| 824 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 825 |
'type' => Controls_Manager::ICONS, |
| 826 |
'label_block' => true, |
| 827 |
'default' => [ |
| 828 |
'value' => 'fa fa-angle-left', |
| 829 |
'library' => 'solid', |
| 830 |
], |
| 831 |
] |
| 832 |
); |
| 833 |
|
| 834 |
$this->add_responsive_control( |
| 835 |
'styles_carousel_arrows_icon_right_h', |
| 836 |
[ |
| 837 |
'label' => esc_html__('Arrow right', 'wpdirectorykit'), |
| 838 |
'type' => Controls_Manager::HEADING, |
| 839 |
'separator' => 'before', |
| 840 |
] |
| 841 |
); |
| 842 |
|
| 843 |
$this->add_responsive_control( |
| 844 |
'styles_carousel_arrows_s_m_right_margin', |
| 845 |
[ |
| 846 |
'label' => esc_html__( 'Margin', 'wpdirectorykit' ), |
| 847 |
'type' => Controls_Manager::DIMENSIONS, |
| 848 |
'size_units' => [ 'px', 'em', '%' ], |
| 849 |
'allowed_dimensions' => 'horizontal', |
| 850 |
'selectors' => [ |
| 851 |
'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};', |
| 852 |
], |
| 853 |
] |
| 854 |
); |
| 855 |
|
| 856 |
$this->add_responsive_control( |
| 857 |
'styles_carousel_arrows_icon_right', |
| 858 |
[ |
| 859 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 860 |
'type' => Controls_Manager::ICONS, |
| 861 |
'label_block' => true, |
| 862 |
'default' => [ |
| 863 |
'value' => 'fa fa-angle-right', |
| 864 |
'library' => 'solid', |
| 865 |
], |
| 866 |
] |
| 867 |
); |
| 868 |
|
| 869 |
$selectors = array( |
| 870 |
'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow', |
| 871 |
'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s' |
| 872 |
); |
| 873 |
$this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']); |
| 874 |
|
| 875 |
$this->end_controls_section(); |
| 876 |
|
| 877 |
$this->start_controls_section( |
| 878 |
'styles_carousel_dots_section', |
| 879 |
[ |
| 880 |
'label' => esc_html__('Section Dots', 'wpdirectorykit'), |
| 881 |
'tab' => Controls_Manager::TAB_STYLE, |
| 882 |
] |
| 883 |
); |
| 884 |
|
| 885 |
$this->add_responsive_control( |
| 886 |
'styles_carousel_dots_hide', |
| 887 |
[ |
| 888 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 889 |
'type' => Controls_Manager::SWITCHER, |
| 890 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 891 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 892 |
'return_value' => 'none', |
| 893 |
'default' => '', |
| 894 |
'selectors' => [ |
| 895 |
'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;', |
| 896 |
], |
| 897 |
] |
| 898 |
); |
| 899 |
|
| 900 |
$this->add_responsive_control( |
| 901 |
'styles_carousel_dots_position_style', |
| 902 |
[ |
| 903 |
'label' => __( 'Position Style', 'wpdirectorykit' ), |
| 904 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 905 |
'default' => 'wdk_slider_dots_out', |
| 906 |
'options' => [ |
| 907 |
'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ), |
| 908 |
'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ), |
| 909 |
], |
| 910 |
] |
| 911 |
); |
| 912 |
|
| 913 |
$this->add_responsive_control( |
| 914 |
'styles_carousel_dots_align', |
| 915 |
[ |
| 916 |
'label' => __( 'Position', 'wpdirectorykit' ), |
| 917 |
'type' => Controls_Manager::CHOOSE, |
| 918 |
'options' => [ |
| 919 |
'left' => [ |
| 920 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 921 |
'icon' => 'eicon-text-align-left', |
| 922 |
], |
| 923 |
'center' => [ |
| 924 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 925 |
'icon' => 'eicon-text-align-center', |
| 926 |
], |
| 927 |
'right' => [ |
| 928 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 929 |
'icon' => 'eicon-text-align-right', |
| 930 |
], |
| 931 |
'justify' => [ |
| 932 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 933 |
'icon' => 'eicon-text-align-justify', |
| 934 |
], |
| 935 |
], |
| 936 |
'render_type' => 'ui', |
| 937 |
'selectors_dictionary' => [ |
| 938 |
'left' => 'justify-content: flex-start;', |
| 939 |
'center' => 'justify-content: center;', |
| 940 |
'right' => 'justify-content: flex-end;', |
| 941 |
'justify' => 'justify-content: space-between;', |
| 942 |
], |
| 943 |
'selectors' => [ |
| 944 |
'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};', |
| 945 |
], |
| 946 |
] |
| 947 |
); |
| 948 |
|
| 949 |
$this->add_responsive_control( |
| 950 |
'styles_carousel_dots_icon', |
| 951 |
[ |
| 952 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 953 |
'type' => Controls_Manager::ICONS, |
| 954 |
'label_block' => true, |
| 955 |
'default' => [ |
| 956 |
'value' => 'fas fa-circle', |
| 957 |
'library' => 'solid', |
| 958 |
], |
| 959 |
] |
| 960 |
); |
| 961 |
|
| 962 |
$selectors = array( |
| 963 |
'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot', |
| 964 |
'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s', |
| 965 |
'active'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li.slick-active .wdk_lr_dot' |
| 966 |
); |
| 967 |
|
| 968 |
$this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']); |
| 969 |
$this->end_controls_section(); |
| 970 |
} |
| 971 |
|
| 972 |
private function generate_controls_content() { |
| 973 |
$this->start_controls_section( |
| 974 |
'content_thumbnail_section', |
| 975 |
[ |
| 976 |
'label' => esc_html__('Colors', 'wpdirectorykit'), |
| 977 |
'tab' => '1', |
| 978 |
] |
| 979 |
); |
| 980 |
|
| 981 |
$this->add_control( |
| 982 |
'content_thumbnail_section_header', |
| 983 |
[ |
| 984 |
'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'), |
| 985 |
'type' => Controls_Manager::HEADING, |
| 986 |
] |
| 987 |
); |
| 988 |
|
| 989 |
$this->add_responsive_control( |
| 990 |
'content_thumbnail_section_d_background', |
| 991 |
[ |
| 992 |
'label' => esc_html__( 'Color', 'wpdirectorykit' ), |
| 993 |
'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ), |
| 994 |
'type' => Controls_Manager::COLOR, |
| 995 |
'selectors' => [ |
| 996 |
'{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};', |
| 997 |
], |
| 998 |
] |
| 999 |
); |
| 1000 |
|
| 1001 |
$this->add_control( |
| 1002 |
'content_thumbnail_section_header_f', |
| 1003 |
[ |
| 1004 |
'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'), |
| 1005 |
'type' => Controls_Manager::HEADING, |
| 1006 |
] |
| 1007 |
); |
| 1008 |
|
| 1009 |
$this->add_group_control( |
| 1010 |
Group_Control_Box_Shadow::get_type(), |
| 1011 |
[ |
| 1012 |
'name' => 'content_thumbnail_section_d_featured', |
| 1013 |
'exclude' => [ |
| 1014 |
'field_shadow_position', |
| 1015 |
], |
| 1016 |
'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured', |
| 1017 |
] |
| 1018 |
); |
| 1019 |
|
| 1020 |
$this->end_controls_section(); |
| 1021 |
|
| 1022 |
|
| 1023 |
$items = [ |
| 1024 |
[ |
| 1025 |
'key'=>'content_card', |
| 1026 |
'label'=> esc_html__('Card', 'wpdirectorykit'), |
| 1027 |
'selector'=>'.wdk-element .wdk-listing-card', |
| 1028 |
'options'=>'full', |
| 1029 |
], |
| 1030 |
[ |
| 1031 |
'key'=>'content_label', |
| 1032 |
'label'=> esc_html__('Over Image Top', 'wpdirectorykit'), |
| 1033 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span', |
| 1034 |
'options'=>'full', |
| 1035 |
], |
| 1036 |
[ |
| 1037 |
'key'=>'content_type', |
| 1038 |
'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'), |
| 1039 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom', |
| 1040 |
'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom', |
| 1041 |
'options'=>'full', |
| 1042 |
], |
| 1043 |
[ |
| 1044 |
'key'=>'content_title', |
| 1045 |
'label'=> esc_html__('Title Part', 'wpdirectorykit'), |
| 1046 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title', |
| 1047 |
'options'=>'full', |
| 1048 |
], |
| 1049 |
[ |
| 1050 |
'key'=>'content_description', |
| 1051 |
'label'=> esc_html__('Subtitle part', 'wpdirectorykit'), |
| 1052 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part', |
| 1053 |
'options'=>'full', |
| 1054 |
], |
| 1055 |
[ |
| 1056 |
'key'=>'content_items', |
| 1057 |
'label'=> esc_html__('Features part', 'wpdirectorykit'), |
| 1058 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span', |
| 1059 |
'options'=>'full', |
| 1060 |
], |
| 1061 |
[ |
| 1062 |
'key'=>'wdk-divider', |
| 1063 |
'label'=> esc_html__('Divider', 'wpdirectorykit'), |
| 1064 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-divider', |
| 1065 |
'options'=>'full', |
| 1066 |
], |
| 1067 |
[ |
| 1068 |
'key'=>'content_price', |
| 1069 |
'label'=> esc_html__('Pricing part', 'wpdirectorykit'), |
| 1070 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price', |
| 1071 |
'options'=>'full', |
| 1072 |
], |
| 1073 |
[ |
| 1074 |
'key'=>'content_button', |
| 1075 |
'label'=> esc_html__('Button Open', 'wpdirectorykit'), |
| 1076 |
'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn', |
| 1077 |
'options'=>'full', |
| 1078 |
], |
| 1079 |
]; |
| 1080 |
|
| 1081 |
foreach ($items as $item) { |
| 1082 |
$this->start_controls_section( |
| 1083 |
$item['key'].'_section', |
| 1084 |
[ |
| 1085 |
'label' => $item['label'], |
| 1086 |
'tab' => '1', |
| 1087 |
] |
| 1088 |
); |
| 1089 |
$this->add_responsive_control( |
| 1090 |
$item['key'].'_hide', |
| 1091 |
[ |
| 1092 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 1093 |
'type' => Controls_Manager::SWITCHER, |
| 1094 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 1095 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 1096 |
'return_value' => 'none', |
| 1097 |
'default' => '', |
| 1098 |
'selectors' => [ |
| 1099 |
'{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};', |
| 1100 |
], |
| 1101 |
] |
| 1102 |
); |
| 1103 |
$selectors = array( |
| 1104 |
'normal' => '{{WRAPPER}} '.$item['selector'], |
| 1105 |
'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s' |
| 1106 |
); |
| 1107 |
|
| 1108 |
if(isset($item['is_featured'])) { |
| 1109 |
$selectors['featured'] = '{{WRAPPER}} '.$item['is_featured']; |
| 1110 |
} |
| 1111 |
$this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); |
| 1112 |
|
| 1113 |
/* special for some elements */ |
| 1114 |
if ($item['key'] == 'content_description') { |
| 1115 |
|
| 1116 |
$this->add_control( |
| 1117 |
'content_description_limit', |
| 1118 |
[ |
| 1119 |
'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ), |
| 1120 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 1121 |
'min' => 1, |
| 1122 |
'max' => 10, |
| 1123 |
'step' => 1, |
| 1124 |
'default' => 3, |
| 1125 |
'selectors' => [ |
| 1126 |
'{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};', |
| 1127 |
], |
| 1128 |
] |
| 1129 |
); |
| 1130 |
|
| 1131 |
} |
| 1132 |
if($item['key'] == 'content_button') { |
| 1133 |
$this->add_control( |
| 1134 |
$item['key'].'_icon', |
| 1135 |
[ |
| 1136 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 1137 |
'type' => Controls_Manager::ICONS, |
| 1138 |
'label_block' => true, |
| 1139 |
'default' => [ |
| 1140 |
'value' => 'fa fa-angle-right', |
| 1141 |
'library' => 'solid', |
| 1142 |
], |
| 1143 |
] |
| 1144 |
); |
| 1145 |
|
| 1146 |
$selectors = array( |
| 1147 |
'normal' => '{{WRAPPER}} '.$item['selector'].' i', |
| 1148 |
); |
| 1149 |
$this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']); |
| 1150 |
} |
| 1151 |
|
| 1152 |
if($item['key'] == 'content_items') { |
| 1153 |
$this->add_control( |
| 1154 |
$item['key'].'_parent_head', |
| 1155 |
[ |
| 1156 |
'label' => esc_html__('Parent Box', 'wpdirectorykit'), |
| 1157 |
'type' => Controls_Manager::HEADING, |
| 1158 |
'separator' => 'before', |
| 1159 |
] |
| 1160 |
); |
| 1161 |
|
| 1162 |
$selectors = array( |
| 1163 |
'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part', |
| 1164 |
); |
| 1165 |
$this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']); |
| 1166 |
} |
| 1167 |
|
| 1168 |
if($item['key'] == 'content_label') { |
| 1169 |
$this->add_control( |
| 1170 |
$item['key'].'_parent_head', |
| 1171 |
[ |
| 1172 |
'label' => esc_html__('Parent Box', 'wpdirectorykit'), |
| 1173 |
'type' => Controls_Manager::HEADING, |
| 1174 |
'separator' => 'before', |
| 1175 |
] |
| 1176 |
); |
| 1177 |
|
| 1178 |
$selectors = array( |
| 1179 |
'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-over-image-top', |
| 1180 |
); |
| 1181 |
$this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']); |
| 1182 |
} |
| 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 |
} |
| 1323 |
} |
| 1324 |
|
| 1325 |
public function enqueue_styles_scripts() { |
| 1326 |
wp_enqueue_style('slick'); |
| 1327 |
wp_enqueue_style('slick-theme'); |
| 1328 |
wp_enqueue_script('slick'); |
| 1329 |
|
| 1330 |
wp_enqueue_style('wdk-notify'); |
| 1331 |
wp_enqueue_script('wdk-notify'); |
| 1332 |
wp_enqueue_style('wdk-listings-carousel'); |
| 1333 |
} |
| 1334 |
} |
| 1335 |
|