PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / elementor-elements / classes / wdk-locations-grid-cover.php

wdk-locations-grid-cover.php in WP Directory Kit 1.5.9, at elementor-elements/classes/wdk-locations-grid-cover.php

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