| 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 |
use Elementor\Group_Control_Css_Filter; |
| 19 |
|
| 20 |
if (!defined('ABSPATH')) |
| 21 |
exit; // Exit if accessed directly |
| 22 |
|
| 23 |
/** |
| 24 |
* @since 1.1.0 |
| 25 |
*/ |
| 26 |
class WdkLocationsGridCover extends WdkElementorBase { |
| 27 |
|
| 28 |
public function __construct($data = array(), $args = null) { |
| 29 |
|
| 30 |
\Elementor\Controls_Manager::add_tab( |
| 31 |
'tab_conf', |
| 32 |
esc_html__('Settings', 'wpdirectorykit') |
| 33 |
); |
| 34 |
|
| 35 |
\Elementor\Controls_Manager::add_tab( |
| 36 |
'tab_layout', |
| 37 |
esc_html__('Layout', 'wpdirectorykit') |
| 38 |
); |
| 39 |
|
| 40 |
\Elementor\Controls_Manager::add_tab( |
| 41 |
'tab_content', |
| 42 |
esc_html__('Main', 'wpdirectorykit') |
| 43 |
); |
| 44 |
|
| 45 |
|
| 46 |
if ($this->is_edit_mode_load()) { |
| 47 |
$this->enqueue_styles_scripts(); |
| 48 |
} |
| 49 |
|
| 50 |
parent::__construct($data, $args); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Retrieve the widget name. |
| 55 |
* |
| 56 |
* @since 1.1.0 |
| 57 |
* |
| 58 |
* @access public |
| 59 |
* |
| 60 |
* @return string Widget name. |
| 61 |
*/ |
| 62 |
public function get_name() { |
| 63 |
return 'wdk-locations-grid-cover'; |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Retrieve the widget title. |
| 68 |
* |
| 69 |
* @since 1.1.0 |
| 70 |
* |
| 71 |
* @access public |
| 72 |
* |
| 73 |
* @return string Widget title. |
| 74 |
*/ |
| 75 |
public function get_title() { |
| 76 |
return esc_html__('Wdk Locations Grid Cover', 'wpdirectorykit'); |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Retrieve the widget icon. |
| 81 |
* |
| 82 |
* @since 1.1.0 |
| 83 |
* |
| 84 |
* @access public |
| 85 |
* |
| 86 |
* @return string Widget icon. |
| 87 |
*/ |
| 88 |
public function get_icon() { |
| 89 |
return 'eicon-featured-image'; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* Register the widget controls. |
| 94 |
* |
| 95 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 96 |
* |
| 97 |
* @since 1.1.0 |
| 98 |
* |
| 99 |
* @access protected |
| 100 |
*/ |
| 101 |
protected function register_controls() { |
| 102 |
$this->generate_controls_conf(); |
| 103 |
$this->generate_controls_layout(); |
| 104 |
$this->generate_controls_styles(); |
| 105 |
$this->generate_controls_content(); |
| 106 |
|
| 107 |
$this->insert_pro_message('1'); |
| 108 |
parent::register_controls(); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Render the widget output on the frontend. |
| 113 |
* |
| 114 |
* Written in PHP and used to generate the final HTML. |
| 115 |
* |
| 116 |
* @since 1.1.0 |
| 117 |
* |
| 118 |
* @access protected |
| 119 |
*/ |
| 120 |
protected function render() { |
| 121 |
parent::render(); |
| 122 |
$this->data['id_element'] = $this->get_id(); |
| 123 |
$this->data['settings'] = $this->get_settings(); |
| 124 |
|
| 125 |
$controller = 'location'; |
| 126 |
$this->WMVC->model($controller.'_m'); |
| 127 |
|
| 128 |
$this->data['results'] = array(); |
| 129 |
|
| 130 |
$controller = 'location'; |
| 131 |
$this->WMVC->model($controller.'_m'); |
| 132 |
$this->WMVC->model('listing_m'); |
| 133 |
|
| 134 |
$this->data['results'] = false; |
| 135 |
|
| 136 |
if($this->data['settings']['conf_results_type'] == 'custom_locations') { |
| 137 |
|
| 138 |
$locations_ids = array(); |
| 139 |
foreach($this->data['settings']['conf_custom_results'] as $location) { |
| 140 |
if(isset($location['location_id']) && !empty($location['location_id'])) { |
| 141 |
$locations_ids [] = $location['location_id']; |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
/* where in */ |
| 146 |
if(!empty($locations_ids)){ |
| 147 |
|
| 148 |
$this->WMVC->db->select($this->WMVC->{$controller.'_m'}->_table_name.'.*, COUNT('.$this->WMVC->listing_m->_table_name.'.post_id) AS listings_counter'); |
| 149 |
$this->WMVC->db->join($this->WMVC->listing_m->_table_name.' ON '.$this->WMVC->listing_m->_table_name.'.location_id = '.$this->WMVC->{$controller.'_m'}->_table_name.'.idlocation', TRUE, 'LEFT'); |
| 150 |
$this->WMVC->db->where($this->WMVC->{$controller.'_m'}->_table_name.'.idlocation IN(' . implode(',', $locations_ids) . ')', null, false); |
| 151 |
$this->WMVC->db->order_by('FIELD('.$this->WMVC->{$controller.'_m'}->_table_name.'.idlocation, '. implode(',', $locations_ids) . ')'); |
| 152 |
$this->WMVC->db->group_by($this->WMVC->{$controller.'_m'}->_primary_key); |
| 153 |
|
| 154 |
$this->data['results'] = $this->WMVC->{$controller.'_m'}->get(); |
| 155 |
} |
| 156 |
|
| 157 |
} else { |
| 158 |
$order_by = NULL; |
| 159 |
/* deprecated, added column listings_counter for this */ |
| 160 |
if($this->data['settings']['conf_order_by'] == 'order_most') { |
| 161 |
/* get location with most listings */ |
| 162 |
global $wpdb; |
| 163 |
$order_by = 'listings_counter '.$this->data['settings']['conf_order']; |
| 164 |
$this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination($this->data['settings']['conf_limit'], null, array(), $order_by); |
| 165 |
} else { |
| 166 |
if (!empty($this->data['settings']['conf_order_by'])) { |
| 167 |
$order_by = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; |
| 168 |
} |
| 169 |
|
| 170 |
$this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination($this->data['settings']['conf_limit'], null, array(), $order_by); |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
$this->data['is_edit_mode']= false; |
| 175 |
if(Plugin::$instance->editor->is_edit_mode()) |
| 176 |
$this->data['is_edit_mode']= true; |
| 177 |
|
| 178 |
echo $this->view('wdk-locations-grid-cover', $this->data); |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
private function generate_controls_conf() { |
| 183 |
$this->start_controls_section( |
| 184 |
'tab_conf_main_section', |
| 185 |
[ |
| 186 |
'label' => esc_html__('Main', 'wpdirectorykit'), |
| 187 |
'tab' => '1', |
| 188 |
] |
| 189 |
); |
| 190 |
|
| 191 |
$pages = array('' => __('Not Selected', 'wpdirectorykit')); |
| 192 |
foreach(get_pages(array('sort_column' => 'post_title')) as $page) |
| 193 |
{ |
| 194 |
$pages[$page->ID] = $page->post_title.' #'.$page->ID; |
| 195 |
} |
| 196 |
|
| 197 |
$this->add_control( |
| 198 |
'conf_link', |
| 199 |
[ |
| 200 |
'label' => __( 'Open results on page', 'wpdirectorykit' ), |
| 201 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 202 |
'default' => '', |
| 203 |
'options' => $pages |
| 204 |
] |
| 205 |
); |
| 206 |
|
| 207 |
$this->add_control( |
| 208 |
'conf_results_type', |
| 209 |
[ |
| 210 |
'label' => __( 'Show type', 'wpdirectorykit' ), |
| 211 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 212 |
'default' => 'results_locations', |
| 213 |
'options' => [ |
| 214 |
'results_locations' => __( 'All Locations', 'wpdirectorykit' ), |
| 215 |
'custom_locations' => __( 'Specific', 'wpdirectorykit' ), |
| 216 |
], |
| 217 |
'separator' => 'after', |
| 218 |
] |
| 219 |
); |
| 220 |
|
| 221 |
$this->add_control( |
| 222 |
'important_note', |
| 223 |
[ |
| 224 |
'label' => '', |
| 225 |
'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 226 |
'raw' => sprintf(__( 'Edit Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')), |
| 227 |
'content_classes' => 'wdk_elementor_hint', |
| 228 |
] |
| 229 |
); |
| 230 |
|
| 231 |
$this->add_control( |
| 232 |
'conf_limit', |
| 233 |
[ |
| 234 |
'label' => __( 'Limit Locations', 'wpdirectorykit' ), |
| 235 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 236 |
'min' => 1, |
| 237 |
'max' => 50, |
| 238 |
'step' => 1, |
| 239 |
'default' => 3, |
| 240 |
'separator' => 'before', |
| 241 |
'conditions' => [ |
| 242 |
'terms' => [ |
| 243 |
[ |
| 244 |
'name' => 'conf_results_type', |
| 245 |
'operator' => '==', |
| 246 |
'value' => 'results_locations', |
| 247 |
] |
| 248 |
], |
| 249 |
], |
| 250 |
] |
| 251 |
); |
| 252 |
|
| 253 |
$this->add_control( |
| 254 |
'conf_order_by', |
| 255 |
[ |
| 256 |
'label' => __('Order By Column', 'wpdirectorykit'), |
| 257 |
'type' => Controls_Manager::SELECT, |
| 258 |
'label_block' => true, |
| 259 |
'options' => [ |
| 260 |
'' => __('None', 'wpdirectorykit'), |
| 261 |
'location_title' => __('Title', 'wpdirectorykit'), |
| 262 |
'idlocation' => __('Location id', 'wpdirectorykit'), |
| 263 |
'order_index' => __('Order index', 'wpdirectorykit'), |
| 264 |
'listings_counter' => __('Most Listings', 'wpdirectorykit'), |
| 265 |
], |
| 266 |
'default' => 'order_index', |
| 267 |
'conditions' => [ |
| 268 |
'terms' => [ |
| 269 |
[ |
| 270 |
'name' => 'conf_results_type', |
| 271 |
'operator' => '==', |
| 272 |
'value' => 'results_locations', |
| 273 |
] |
| 274 |
], |
| 275 |
], |
| 276 |
] |
| 277 |
); |
| 278 |
|
| 279 |
$this->add_control( |
| 280 |
'conf_order', |
| 281 |
[ |
| 282 |
'label' => __('Order', 'wpdirectorykit'), |
| 283 |
'type' => Controls_Manager::SELECT, |
| 284 |
'label_block' => true, |
| 285 |
'options' => [ |
| 286 |
'asc' => __('Ascending', 'wpdirectorykit'), |
| 287 |
'desc' => __('Descending', 'wpdirectorykit') |
| 288 |
], |
| 289 |
'default' => 'desc', |
| 290 |
'conditions' => [ |
| 291 |
'terms' => [ |
| 292 |
[ |
| 293 |
'name' => 'conf_results_type', |
| 294 |
'operator' => '==', |
| 295 |
'value' => 'results_locations', |
| 296 |
] |
| 297 |
], |
| 298 |
], |
| 299 |
] |
| 300 |
); |
| 301 |
|
| 302 |
if(true){ |
| 303 |
$repeater = new Repeater(); |
| 304 |
$repeater->start_controls_tabs( 'locations' ); |
| 305 |
$repeater->add_control( |
| 306 |
'location_id', |
| 307 |
[ |
| 308 |
'label' => __( 'ID location', 'wpdirectorykit' ), |
| 309 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 310 |
'min' => 1, |
| 311 |
'step' => 1, |
| 312 |
] |
| 313 |
); |
| 314 |
$repeater->end_controls_tabs(); |
| 315 |
|
| 316 |
|
| 317 |
$this->add_control( |
| 318 |
'conf_custom_results', |
| 319 |
[ |
| 320 |
'type' => Controls_Manager::REPEATER, |
| 321 |
'fields' => $repeater->get_controls(), |
| 322 |
'default' => [ |
| 323 |
], |
| 324 |
'title_field' => '{{{ location_id }}}', |
| 325 |
'conditions' => [ |
| 326 |
'terms' => [ |
| 327 |
[ |
| 328 |
'name' => 'conf_results_type', |
| 329 |
'operator' => '==', |
| 330 |
'value' => 'custom_locations', |
| 331 |
] |
| 332 |
], |
| 333 |
], |
| 334 |
] |
| 335 |
); |
| 336 |
} |
| 337 |
|
| 338 |
$this->end_controls_section(); |
| 339 |
|
| 340 |
} |
| 341 |
|
| 342 |
private function generate_controls_layout() { |
| 343 |
} |
| 344 |
|
| 345 |
private function generate_controls_styles() { |
| 346 |
$this->start_controls_section( |
| 347 |
'styles_thmbn_section', |
| 348 |
[ |
| 349 |
'label' => esc_html__('Main', 'wpdirectorykit'), |
| 350 |
'tab' => Controls_Manager::TAB_STYLE, |
| 351 |
] |
| 352 |
); |
| 353 |
|
| 354 |
$this->add_responsive_control( |
| 355 |
'row_gap_col', |
| 356 |
[ |
| 357 |
'label' => __( 'Columns', 'wpdirectorykit' ), |
| 358 |
'type' => Controls_Manager::SELECT, |
| 359 |
'options' => [ |
| 360 |
'' => esc_html__('Default', 'wpdirectorykit'), |
| 361 |
'auto' => esc_html__('Auto', 'wpdirectorykit'), |
| 362 |
'100%' => '1', |
| 363 |
'50%' => '2', |
| 364 |
'calc(100% / 3)' => '3', |
| 365 |
'25%' => '4', |
| 366 |
'20%' => '5', |
| 367 |
'auto_flexible' => 'auto flexible', |
| 368 |
], |
| 369 |
'selectors_dictionary' => [ |
| 370 |
'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto', |
| 371 |
'100%' => '-webkit-flex:1 2 100%;flex:1 2 100%', |
| 372 |
'50%' => '-webkit-flex:1 2 50%;flex:1 2 50%', |
| 373 |
'calc(100% / 3)' => '-webkit-flex:1 2 calc(100% / 3);flex:1 2 calc(100% / 3)', |
| 374 |
'25%' => '-webkit-flex:1 2 25%;flex:1 2 25%', |
| 375 |
'20%' => '-webkit-flex:1 2 20%;flex:1 2 20%', |
| 376 |
'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto', |
| 377 |
'auto_flexible' => '-webkit-flex:1 2 auto;flex:1 2 auto', |
| 378 |
], |
| 379 |
'selectors' => [ |
| 380 |
'{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}', |
| 381 |
], |
| 382 |
'default' => 'calc(100% / 3)', |
| 383 |
'separator' => 'before', |
| 384 |
] |
| 385 |
); |
| 386 |
|
| 387 |
$this->add_responsive_control( |
| 388 |
'column_gap', |
| 389 |
[ |
| 390 |
'label' => esc_html__('Columns Gap', 'wpdirectorykit'), |
| 391 |
'type' => Controls_Manager::SLIDER, |
| 392 |
'default' => [ |
| 393 |
'size' => 10, |
| 394 |
], |
| 395 |
'range' => [ |
| 396 |
'px' => [ |
| 397 |
'min' => 0, |
| 398 |
'max' => 60, |
| 399 |
], |
| 400 |
], |
| 401 |
'selectors' => [ |
| 402 |
'{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;', |
| 403 |
'{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};', |
| 404 |
], |
| 405 |
] |
| 406 |
); |
| 407 |
|
| 408 |
$this->add_responsive_control( |
| 409 |
'row_gap', |
| 410 |
[ |
| 411 |
'label' => esc_html__('Rows Gap', 'wpdirectorykit'), |
| 412 |
'type' => Controls_Manager::SLIDER, |
| 413 |
'default' => [ |
| 414 |
'size' => 10, |
| 415 |
], |
| 416 |
'range' => [ |
| 417 |
'px' => [ |
| 418 |
'min' => 0, |
| 419 |
'max' => 60, |
| 420 |
], |
| 421 |
], |
| 422 |
'selectors' => [ |
| 423 |
'{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 424 |
'{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};', |
| 425 |
], |
| 426 |
] |
| 427 |
); |
| 428 |
|
| 429 |
$this->end_controls_section(); |
| 430 |
|
| 431 |
$this->start_controls_section( |
| 432 |
'content_thumbnail_section', |
| 433 |
[ |
| 434 |
'label' => esc_html__('Colors', 'wpdirectorykit'), |
| 435 |
'tab' => Controls_Manager::TAB_STYLE, |
| 436 |
] |
| 437 |
); |
| 438 |
|
| 439 |
$this->add_control( |
| 440 |
'content_thumbnail_section_header', |
| 441 |
[ |
| 442 |
'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'), |
| 443 |
'type' => Controls_Manager::HEADING, |
| 444 |
] |
| 445 |
); |
| 446 |
|
| 447 |
$this->add_responsive_control( |
| 448 |
'content_thumbnail_section_d_background', |
| 449 |
[ |
| 450 |
'label' => esc_html__( 'Color', 'wpdirectorykit' ), |
| 451 |
'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ), |
| 452 |
'type' => Controls_Manager::COLOR, |
| 453 |
'selectors' => [ |
| 454 |
'{{WRAPPER}} .wdk-locations-card-cover::before, {{WRAPPER}} .wdk-locations-card-cover::after,{{WRAPPER}} .wdk-locations-card-cover .overlay' => 'background-color: {{VALUE}};', |
| 455 |
], |
| 456 |
] |
| 457 |
); |
| 458 |
|
| 459 |
$this->end_controls_section(); |
| 460 |
|
| 461 |
$this->start_controls_section( |
| 462 |
'styles_card', |
| 463 |
[ |
| 464 |
'label' => esc_html__('Card', 'wpdirectorykit'), |
| 465 |
'tab' => Controls_Manager::TAB_STYLE, |
| 466 |
] |
| 467 |
); |
| 468 |
|
| 469 |
$selectors = array( |
| 470 |
'normal' => '{{WRAPPER}} .wdk-locations-card-cover', |
| 471 |
'hover' => '{{WRAPPER}} .wdk-locations-card-cover%1$s', |
| 472 |
); |
| 473 |
$this->generate_renders_tabs($selectors, 'styles_card_dynamic', ['background','border','border_radius','padding','shadow','transition']); |
| 474 |
|
| 475 |
$this->add_responsive_control ( |
| 476 |
'styles_card_height', |
| 477 |
[ |
| 478 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 479 |
'type' => Controls_Manager::SLIDER, |
| 480 |
'range' => [ |
| 481 |
'px' => [ |
| 482 |
'min' => 0, |
| 483 |
'max' => 1500, |
| 484 |
], |
| 485 |
'vw' => [ |
| 486 |
'min' => 0, |
| 487 |
'max' => 100, |
| 488 |
], |
| 489 |
], |
| 490 |
'size_units' => [ 'px', 'vw' ], |
| 491 |
'selectors' => [ |
| 492 |
'{{WRAPPER}} .wdk-locations-card-cover' => 'height: {{SIZE}}{{UNIT}}', |
| 493 |
], |
| 494 |
'separator' => 'after', |
| 495 |
] |
| 496 |
); |
| 497 |
|
| 498 |
$this->add_responsive_control( |
| 499 |
't_content_basic_position_x', |
| 500 |
[ |
| 501 |
'label' => __( 'Position Content', 'wpdirectorykit' ), |
| 502 |
'type' => Controls_Manager::CHOOSE, |
| 503 |
'options' => [ |
| 504 |
'top' => [ |
| 505 |
'title' => esc_html__( 'Top', 'wpdirectorykit' ), |
| 506 |
'icon' => 'eicon-v-align-top', |
| 507 |
], |
| 508 |
'center' => [ |
| 509 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 510 |
'icon' => 'eicon-v-align-middle', |
| 511 |
], |
| 512 |
'bottom' => [ |
| 513 |
'title' => esc_html__( 'bottom', 'wpdirectorykit' ), |
| 514 |
'icon' => ' eicon-v-align-bottom', |
| 515 |
], |
| 516 |
'stretch' => [ |
| 517 |
'title' => esc_html__( 'Stretch', 'wpdirectorykit' ), |
| 518 |
'icon' => 'eicon-v-align-stretch', |
| 519 |
], |
| 520 |
], |
| 521 |
'default' => 'left', |
| 522 |
'render_type' => 'template', |
| 523 |
'selectors_dictionary' => [ |
| 524 |
'top' => 'align-items: flex-start;', |
| 525 |
'center' => 'align-items: center;', |
| 526 |
'bottom' => 'align-items: flex-end;', |
| 527 |
'stretch' => 'align-items: stretch;', |
| 528 |
], |
| 529 |
'selectors' => [ |
| 530 |
'{{WRAPPER}} .wdk-locations-card-cover' => '{{VALUE}};', |
| 531 |
], |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
$this->add_group_control( |
| 536 |
Group_Control_Css_Filter::get_type(), |
| 537 |
[ |
| 538 |
'name' => 'css_filters', |
| 539 |
'selector' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-image', |
| 540 |
] |
| 541 |
); |
| 542 |
|
| 543 |
$this->add_responsive_control( |
| 544 |
't_content_basic_mask', |
| 545 |
[ |
| 546 |
'label' => esc_html__( 'Mask', 'wpdirectorykit' ), |
| 547 |
'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ), |
| 548 |
'type' => Controls_Manager::COLOR, |
| 549 |
'selectors' => [ |
| 550 |
'{{WRAPPER}} .wdk-locations-card-cover .mask' => 'background-color: {{VALUE}};', |
| 551 |
], |
| 552 |
] |
| 553 |
); |
| 554 |
|
| 555 |
$this->add_responsive_control( |
| 556 |
't_content_basic_mask_hover', |
| 557 |
[ |
| 558 |
'label' => esc_html__( 'Mask Hover', 'wpdirectorykit' ), |
| 559 |
'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ), |
| 560 |
'type' => Controls_Manager::COLOR, |
| 561 |
'selectors' => [ |
| 562 |
'{{WRAPPER}} .wdk-locations-card-cover:hover .mask' => 'background-color: {{VALUE}};', |
| 563 |
], |
| 564 |
] |
| 565 |
); |
| 566 |
|
| 567 |
$this->end_controls_section(); |
| 568 |
|
| 569 |
|
| 570 |
$items = [ |
| 571 |
[ |
| 572 |
'key'=>'content', |
| 573 |
'label'=> esc_html__('Content', 'wpdirectorykit'), |
| 574 |
'selector'=>'.wdk-locations-card-body', |
| 575 |
'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body', |
| 576 |
'options'=>['background','border','border_radius','padding','shadow','transition'], |
| 577 |
], |
| 578 |
[ |
| 579 |
'key'=>'content_title', |
| 580 |
'label'=> esc_html__('Title', 'wpdirectorykit'), |
| 581 |
'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-title', |
| 582 |
'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-title', |
| 583 |
'options'=>'full', |
| 584 |
], |
| 585 |
[ |
| 586 |
'key'=>'content_subtitle', |
| 587 |
'label'=> esc_html__('Count', 'wpdirectorykit'), |
| 588 |
'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-listings-count', |
| 589 |
'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-listings-count', |
| 590 |
'options'=>'full', |
| 591 |
], |
| 592 |
[ |
| 593 |
'key'=>'content_button', |
| 594 |
'label'=> esc_html__('Button', 'wpdirectorykit'), |
| 595 |
'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-location-btn', |
| 596 |
'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-location-btn', |
| 597 |
'options'=>['margin','align','color','background','border','border_radius','padding','shadow','transition'], |
| 598 |
], |
| 599 |
]; |
| 600 |
|
| 601 |
foreach ($items as $item) { |
| 602 |
$this->start_controls_section( |
| 603 |
$item['key'].'_section', |
| 604 |
[ |
| 605 |
'label' => $item['label'], |
| 606 |
'tab' => Controls_Manager::TAB_STYLE, |
| 607 |
] |
| 608 |
); |
| 609 |
$this->add_responsive_control( |
| 610 |
$item['key'].'_hide', |
| 611 |
[ |
| 612 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 613 |
'type' => Controls_Manager::SWITCHER, |
| 614 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 615 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 616 |
'return_value' => 'none', |
| 617 |
'default' => '', |
| 618 |
'selectors' => [ |
| 619 |
'{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};', |
| 620 |
], |
| 621 |
] |
| 622 |
); |
| 623 |
|
| 624 |
$selectors = array( |
| 625 |
'normal' => '{{WRAPPER}} '.$item['selector'], |
| 626 |
'hover'=>'{{WRAPPER}} '.$item['selector_hover'], |
| 627 |
); |
| 628 |
$this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); |
| 629 |
|
| 630 |
if( $item['key'] =='content') { |
| 631 |
$selectors = array( |
| 632 |
'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-left-content', |
| 633 |
'hover'=>'{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-left-content' |
| 634 |
); |
| 635 |
$this->generate_renders_tabs($selectors, $item['key'].'_dynamic_padding', ['padding']); |
| 636 |
} |
| 637 |
|
| 638 |
if( $item['key'] =='content_button') { |
| 639 |
$this->add_control( |
| 640 |
'link_icon', |
| 641 |
[ |
| 642 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 643 |
'type' => Controls_Manager::ICONS, |
| 644 |
'label_block' => true, |
| 645 |
'default' => [ |
| 646 |
'value' => 'fa fa-angle-right', |
| 647 |
'library' => 'solid', |
| 648 |
], |
| 649 |
] |
| 650 |
); |
| 651 |
|
| 652 |
$this->add_responsive_control ( |
| 653 |
'link_icon_height', |
| 654 |
[ |
| 655 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 656 |
'type' => Controls_Manager::SLIDER, |
| 657 |
'range' => [ |
| 658 |
'px' => [ |
| 659 |
'min' => 0, |
| 660 |
'max' => 1500, |
| 661 |
], |
| 662 |
'vw' => [ |
| 663 |
'min' => 0, |
| 664 |
'max' => 100, |
| 665 |
], |
| 666 |
], |
| 667 |
'size_units' => [ 'px', 'vw' ], |
| 668 |
'selectors' => [ |
| 669 |
'{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-location-btn' => 'font-size: {{SIZE}}{{UNIT}}', |
| 670 |
], |
| 671 |
'separator' => 'after', |
| 672 |
] |
| 673 |
); |
| 674 |
|
| 675 |
} |
| 676 |
|
| 677 |
$this->end_controls_section(); |
| 678 |
} |
| 679 |
|
| 680 |
$this->start_controls_section( |
| 681 |
'content_icon_section', |
| 682 |
[ |
| 683 |
'label' => esc_html__( 'Icon', 'wpdirectorykit' ), |
| 684 |
'tab' => Controls_Manager::TAB_STYLE, |
| 685 |
] |
| 686 |
); |
| 687 |
|
| 688 |
$this->add_responsive_control( |
| 689 |
'content_icon_show', |
| 690 |
[ |
| 691 |
'label' => esc_html__( 'Show Element', 'wpdirectorykit' ), |
| 692 |
'type' => Controls_Manager::SWITCHER, |
| 693 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 694 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 695 |
'return_value' => 'flex', |
| 696 |
'default' => '', |
| 697 |
'selectors' => [ |
| 698 |
'{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left' => 'display: flex;', |
| 699 |
], |
| 700 |
] |
| 701 |
); |
| 702 |
|
| 703 |
|
| 704 |
$this->add_control( |
| 705 |
'content_icon_type', |
| 706 |
[ |
| 707 |
'label' => __( 'Show type', 'wpdirectorykit' ), |
| 708 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 709 |
'default' => 'font', |
| 710 |
'options' => [ |
| 711 |
'font' => __( 'Font icon code', 'wpdirectorykit' ), |
| 712 |
'image' => __( 'Image Icon', 'wpdirectorykit' ), |
| 713 |
], |
| 714 |
] |
| 715 |
); |
| 716 |
|
| 717 |
$selectors = array( |
| 718 |
'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left', |
| 719 |
'hover'=>'{{WRAPPER}} .wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-action-left', |
| 720 |
); |
| 721 |
$this->generate_renders_tabs($selectors, 'content_icon_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition']); |
| 722 |
|
| 723 |
$this->add_control( |
| 724 |
'content_icon_im_tab', |
| 725 |
[ |
| 726 |
'label' => esc_html__('Image Icon', 'wpdirectorykit'), |
| 727 |
'type' => Controls_Manager::HEADING, |
| 728 |
'separator' => 'after', |
| 729 |
] |
| 730 |
); |
| 731 |
|
| 732 |
$selectors = array( |
| 733 |
'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left img', |
| 734 |
); |
| 735 |
$this->generate_renders_tabs($selectors, 'content_icon_im_dynamic', ['image_size_control']); |
| 736 |
|
| 737 |
$this->add_control( |
| 738 |
'content_icon_f_tab', |
| 739 |
[ |
| 740 |
'label' => esc_html__('Font Icon', 'wpdirectorykit'), |
| 741 |
'type' => Controls_Manager::HEADING, |
| 742 |
'separator' => 'after', |
| 743 |
] |
| 744 |
); |
| 745 |
|
| 746 |
$selectors = array( |
| 747 |
'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left i', |
| 748 |
); |
| 749 |
$this->generate_renders_tabs($selectors, 'content_icon_f_dynamic', ['font-size']); |
| 750 |
|
| 751 |
|
| 752 |
$this->end_controls_section(); |
| 753 |
} |
| 754 |
|
| 755 |
private function generate_controls_content() { |
| 756 |
|
| 757 |
} |
| 758 |
|
| 759 |
public function enqueue_styles_scripts() { |
| 760 |
wp_enqueue_style('wdk-locations-grid-cover'); |
| 761 |
} |
| 762 |
} |
| 763 |
|