PluginProbe
WP Directory Kit / 1.3.3
WP Directory Kit v1.3.3
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 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-locations-grid-cover.php

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

783 lines 29.4 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 \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((!empty($this->data['settings']['conf_limit'])) ? $this->data['settings']['conf_limit'] : NULL, null, array(), $order_by);
165 } else {
166 $where = array();
167 if (!empty($this->data['settings']['conf_order_by'])) {
168 $order_by = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'];
169 }
170
171 if (!empty($this->data['settings']['only_root_enable']) && $this->data['settings']['only_root_enable'] == 'yes') {
172 $where['('.$this->WMVC->{$controller.'_m'}->_table_name.'.level = 0)'] = NULL;
173 }
174
175 $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);
176
177
178 }
179 }
180
181 $this->data['is_edit_mode']= false;
182 if(Plugin::$instance->editor->is_edit_mode())
183 $this->data['is_edit_mode']= true;
184
185 echo $this->view('wdk-locations-grid-cover', $this->data);
186 }
187
188
189 private function generate_controls_conf() {
190 $this->start_controls_section(
191 'tab_conf_main_section',
192 [
193 'label' => esc_html__('Main', 'wpdirectorykit'),
194 'tab' => '1',
195 ]
196 );
197
198 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
199 foreach(get_pages(array('sort_column' => 'post_title')) as $page)
200 {
201 $pages[$page->ID] = $page->post_title.' #'.$page->ID;
202 }
203
204 $this->add_control(
205 'conf_link',
206 [
207 'label' => __( 'Open results on page', 'wpdirectorykit' ),
208 'type' => \Elementor\Controls_Manager::SELECT2,
209 'default' => '',
210 'options' => $pages
211 ]
212 );
213
214 $this->add_control(
215 'conf_results_type',
216 [
217 'label' => __( 'Show type', 'wpdirectorykit' ),
218 'type' => \Elementor\Controls_Manager::SELECT,
219 'default' => 'results_locations',
220 'options' => [
221 'results_locations' => __( 'All Locations', 'wpdirectorykit' ),
222 'custom_locations' => __( 'Specific', 'wpdirectorykit' ),
223 ],
224 'separator' => 'after',
225 ]
226 );
227
228 $this->add_control(
229 'important_note',
230 [
231 'label' => '',
232 'type' => \Elementor\Controls_Manager::RAW_HTML,
233 'raw' => wdk_sprintf(__( 'Edit Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')),
234 'content_classes' => 'wdk_elementor_hint',
235 ]
236 );
237
238 $this->add_responsive_control(
239 'only_root_enable',
240 [
241 'label' => esc_html__( 'Show only Root', 'wpdirectorykit' ),
242 'type' => Controls_Manager::SWITCHER,
243 'none' => esc_html__( 'No', 'wpdirectorykit' ),
244 'block' => esc_html__( 'Yes', 'wpdirectorykit' ),
245 'return_value' => 'yes',
246 'default' => 'yes',
247 ]
248 );
249
250 $this->add_control(
251 'conf_limit',
252 [
253 'label' => __( 'Limit Locations', 'wpdirectorykit' ),
254 'description' => __( 'Set 0 for unlimit', 'wpdirectorykit' ),
255 'type' => \Elementor\Controls_Manager::NUMBER,
256 'min' => 0,
257 'max' => 500,
258 'step' => 1,
259 'default' => 3,
260 'separator' => 'before',
261 'conditions' => [
262 'terms' => [
263 [
264 'name' => 'conf_results_type',
265 'operator' => '==',
266 'value' => 'results_locations',
267 ]
268 ],
269 ],
270 ]
271 );
272
273 $this->add_control(
274 'conf_order_by',
275 [
276 'label' => __('Order By Column', 'wpdirectorykit'),
277 'type' => Controls_Manager::SELECT,
278 'label_block' => true,
279 'options' => [
280 '' => __('None', 'wpdirectorykit'),
281 'location_title' => __('Title', 'wpdirectorykit'),
282 'idlocation' => __('Location id', 'wpdirectorykit'),
283 'order_index' => __('Order index', 'wpdirectorykit'),
284 'listings_counter' => __('Most Listings', 'wpdirectorykit'),
285 ],
286 'default' => 'order_index',
287 'conditions' => [
288 'terms' => [
289 [
290 'name' => 'conf_results_type',
291 'operator' => '==',
292 'value' => 'results_locations',
293 ]
294 ],
295 ],
296 ]
297 );
298
299 $this->add_control(
300 'conf_order',
301 [
302 'label' => __('Order', 'wpdirectorykit'),
303 'type' => Controls_Manager::SELECT,
304 'label_block' => true,
305 'options' => [
306 'asc' => __('Ascending', 'wpdirectorykit'),
307 'desc' => __('Descending', 'wpdirectorykit')
308 ],
309 'default' => 'desc',
310 'conditions' => [
311 'terms' => [
312 [
313 'name' => 'conf_results_type',
314 'operator' => '==',
315 'value' => 'results_locations',
316 ]
317 ],
318 ],
319 ]
320 );
321
322 if(true){
323 $repeater = new Repeater();
324 $repeater->start_controls_tabs( 'locations' );
325 $repeater->add_control(
326 'location_id',
327 [
328 'label' => __( 'ID location', 'wpdirectorykit' ),
329 'type' => \Elementor\Controls_Manager::NUMBER,
330 'min' => 1,
331 'step' => 1,
332 ]
333 );
334 $repeater->end_controls_tabs();
335
336
337 $this->add_control(
338 'conf_custom_results',
339 [
340 'type' => Controls_Manager::REPEATER,
341 'fields' => $repeater->get_controls(),
342 'default' => [
343 ],
344 'title_field' => '{{{ location_id }}}',
345 'conditions' => [
346 'terms' => [
347 [
348 'name' => 'conf_results_type',
349 'operator' => '==',
350 'value' => 'custom_locations',
351 ]
352 ],
353 ],
354 ]
355 );
356 }
357
358 $this->end_controls_section();
359
360 }
361
362 private function generate_controls_layout() {
363 }
364
365 private function generate_controls_styles() {
366 $this->start_controls_section(
367 'styles_thmbn_section',
368 [
369 'label' => esc_html__('Main', 'wpdirectorykit'),
370 'tab' => Controls_Manager::TAB_STYLE,
371 ]
372 );
373
374 $this->add_responsive_control(
375 'row_gap_col',
376 [
377 'label' => __( 'Columns', 'wpdirectorykit' ),
378 'type' => Controls_Manager::SELECT,
379 'options' => [
380 '' => esc_html__('Default', 'wpdirectorykit'),
381 'auto' => esc_html__('Auto', 'wpdirectorykit'),
382 '100%' => '1',
383 '50%' => '2',
384 'calc(100% / 3)' => '3',
385 '25%' => '4',
386 '20%' => '5',
387 'auto_flexible' => 'auto flexible',
388 ],
389 'selectors_dictionary' => [
390 'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto',
391 '100%' => '-webkit-flex:1 2 100%;flex:1 2 100%',
392 '50%' => '-webkit-flex:1 2 50%;flex:1 2 50%',
393 'calc(100% / 3)' => '-webkit-flex:1 2 calc(100% / 3);flex:1 2 calc(100% / 3)',
394 '25%' => '-webkit-flex:1 2 25%;flex:1 2 25%',
395 '20%' => '-webkit-flex:1 2 20%;flex:1 2 20%',
396 'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto',
397 'auto_flexible' => '-webkit-flex:1 2 auto;flex:1 2 auto',
398 ],
399 'selectors' => [
400 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
401 ],
402 'default' => 'calc(100% / 3)',
403 'separator' => 'before',
404 ]
405 );
406
407 $this->add_responsive_control(
408 'column_gap',
409 [
410 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
411 'type' => Controls_Manager::SLIDER,
412 'default' => [
413 'size' => 10,
414 ],
415 'range' => [
416 'px' => [
417 'min' => 0,
418 'max' => 60,
419 ],
420 ],
421 'selectors' => [
422 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
423 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
424 ],
425 ]
426 );
427
428 $this->add_responsive_control(
429 'row_gap',
430 [
431 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
432 'type' => Controls_Manager::SLIDER,
433 'default' => [
434 'size' => 10,
435 ],
436 'range' => [
437 'px' => [
438 'min' => 0,
439 'max' => 60,
440 ],
441 ],
442 'selectors' => [
443 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
444 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
445 ],
446 ]
447 );
448
449 $this->end_controls_section();
450
451 $this->start_controls_section(
452 'content_thumbnail_section',
453 [
454 'label' => esc_html__('Colors', 'wpdirectorykit'),
455 'tab' => Controls_Manager::TAB_STYLE,
456 ]
457 );
458
459 $this->add_control(
460 'content_thumbnail_section_header',
461 [
462 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
463 'type' => Controls_Manager::HEADING,
464 ]
465 );
466
467 $this->add_responsive_control(
468 'content_thumbnail_section_d_background',
469 [
470 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
471 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
472 'type' => Controls_Manager::COLOR,
473 'selectors' => [
474 '{{WRAPPER}} .wdk-locations-card-cover::before, {{WRAPPER}} .wdk-locations-card-cover::after,{{WRAPPER}} .wdk-locations-card-cover .overlay' => 'background-color: {{VALUE}};',
475 ],
476 ]
477 );
478
479 $this->end_controls_section();
480
481 $this->start_controls_section(
482 'styles_card',
483 [
484 'label' => esc_html__('Card', 'wpdirectorykit'),
485 'tab' => Controls_Manager::TAB_STYLE,
486 ]
487 );
488
489 $selectors = array(
490 'normal' => '{{WRAPPER}} .wdk-locations-card-cover',
491 'hover' => '{{WRAPPER}} .wdk-locations-card-cover%1$s',
492 );
493 $this->generate_renders_tabs($selectors, 'styles_card_dynamic', ['background','border','border_radius','padding','shadow','transition']);
494
495 $this->add_responsive_control (
496 'styles_card_height',
497 [
498 'label' => esc_html__('Height', 'wpdirectorykit'),
499 'type' => Controls_Manager::SLIDER,
500 'range' => [
501 'px' => [
502 'min' => 0,
503 'max' => 1500,
504 ],
505 'vw' => [
506 'min' => 0,
507 'max' => 100,
508 ],
509 ],
510 'size_units' => [ 'px', 'vw' ],
511 'selectors' => [
512 '{{WRAPPER}} .wdk-locations-card-cover' => 'height: {{SIZE}}{{UNIT}}',
513 ],
514 'separator' => 'after',
515 ]
516 );
517
518 $this->add_responsive_control(
519 't_content_basic_position_x',
520 [
521 'label' => __( 'Position Content', 'wpdirectorykit' ),
522 'type' => Controls_Manager::CHOOSE,
523 'options' => [
524 'top' => [
525 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
526 'icon' => 'eicon-v-align-top',
527 ],
528 'center' => [
529 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
530 'icon' => 'eicon-v-align-middle',
531 ],
532 'bottom' => [
533 'title' => esc_html__( 'bottom', 'wpdirectorykit' ),
534 'icon' => ' eicon-v-align-bottom',
535 ],
536 'stretch' => [
537 'title' => esc_html__( 'Stretch', 'wpdirectorykit' ),
538 'icon' => 'eicon-v-align-stretch',
539 ],
540 ],
541 'default' => 'left',
542 'render_type' => 'template',
543 'selectors_dictionary' => [
544 'top' => 'align-items: flex-start;',
545 'center' => 'align-items: center;',
546 'bottom' => 'align-items: flex-end;',
547 'stretch' => 'align-items: stretch;',
548 ],
549 'selectors' => [
550 '{{WRAPPER}} .wdk-locations-card-cover' => '{{VALUE}};',
551 ],
552 ]
553 );
554
555 $this->add_group_control(
556 Group_Control_Css_Filter::get_type(),
557 [
558 'name' => 'css_filters',
559 'selector' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-image',
560 ]
561 );
562
563 $this->add_responsive_control(
564 't_content_basic_mask',
565 [
566 'label' => esc_html__( 'Mask', 'wpdirectorykit' ),
567 'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ),
568 'type' => Controls_Manager::COLOR,
569 'selectors' => [
570 '{{WRAPPER}} .wdk-locations-card-cover .mask' => 'background-color: {{VALUE}};',
571 ],
572 ]
573 );
574
575 $this->add_responsive_control(
576 't_content_basic_mask_hover',
577 [
578 'label' => esc_html__( 'Mask Hover', 'wpdirectorykit' ),
579 'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ),
580 'type' => Controls_Manager::COLOR,
581 'selectors' => [
582 '{{WRAPPER}} .wdk-locations-card-cover:hover .mask' => 'background-color: {{VALUE}};',
583 ],
584 ]
585 );
586
587 $this->end_controls_section();
588
589
590 $items = [
591 [
592 'key'=>'content',
593 'label'=> esc_html__('Content', 'wpdirectorykit'),
594 'selector'=>'.wdk-locations-card-body',
595 'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body',
596 'options'=>['background','border','border_radius','padding','shadow','transition'],
597 ],
598 [
599 'key'=>'content_title',
600 'label'=> esc_html__('Title', 'wpdirectorykit'),
601 'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-title',
602 'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-title',
603 'options'=>'full',
604 ],
605 [
606 'key'=>'content_subtitle',
607 'label'=> esc_html__('Count', 'wpdirectorykit'),
608 'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-listings-count',
609 'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-listings-count',
610 'options'=>'full',
611 ],
612 [
613 'key'=>'content_button',
614 'label'=> esc_html__('Button', 'wpdirectorykit'),
615 'selector'=>'.wdk-locations-card-cover .wdk-locations-card-body .wdk-location-btn',
616 'selector_hover'=>'.wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-location-btn',
617 'options'=>['margin','align','color','background','border','border_radius','padding','shadow','transition'],
618 ],
619 ];
620
621 foreach ($items as $item) {
622 $this->start_controls_section(
623 $item['key'].'_section',
624 [
625 'label' => $item['label'],
626 'tab' => Controls_Manager::TAB_STYLE,
627 ]
628 );
629 $this->add_responsive_control(
630 $item['key'].'_hide',
631 [
632 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
633 'type' => Controls_Manager::SWITCHER,
634 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
635 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
636 'return_value' => 'none',
637 'default' => '',
638 'selectors' => [
639 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
640 ],
641 ]
642 );
643
644 $selectors = array(
645 'normal' => '{{WRAPPER}} '.$item['selector'],
646 'hover'=>'{{WRAPPER}} '.$item['selector_hover'],
647 );
648 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
649
650 if( $item['key'] =='content') {
651 $selectors = array(
652 'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-left-content',
653 'hover'=>'{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-left-content'
654 );
655 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic_padding', ['padding']);
656 }
657
658 if( $item['key'] =='content_button') {
659 $this->add_control(
660 'link_icon',
661 [
662 'label' => esc_html__('Icon', 'wpdirectorykit'),
663 'type' => Controls_Manager::ICONS,
664 'label_block' => true,
665 'default' => [
666 'value' => 'fa fa-angle-right',
667 'library' => 'solid',
668 ],
669 ]
670 );
671
672 $this->add_responsive_control (
673 'link_icon_height',
674 [
675 'label' => esc_html__('Height', 'wpdirectorykit'),
676 'type' => Controls_Manager::SLIDER,
677 'range' => [
678 'px' => [
679 'min' => 0,
680 'max' => 1500,
681 ],
682 'vw' => [
683 'min' => 0,
684 'max' => 100,
685 ],
686 ],
687 'size_units' => [ 'px', 'vw' ],
688 'selectors' => [
689 '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-location-btn' => 'font-size: {{SIZE}}{{UNIT}}',
690 ],
691 'separator' => 'after',
692 ]
693 );
694
695 }
696
697 $this->end_controls_section();
698 }
699
700 $this->start_controls_section(
701 'content_icon_section',
702 [
703 'label' => esc_html__( 'Icon', 'wpdirectorykit' ),
704 'tab' => Controls_Manager::TAB_STYLE,
705 ]
706 );
707
708 $this->add_responsive_control(
709 'content_icon_show',
710 [
711 'label' => esc_html__( 'Show Element', 'wpdirectorykit' ),
712 'type' => Controls_Manager::SWITCHER,
713 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
714 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
715 'return_value' => 'flex',
716 'default' => '',
717 'selectors' => [
718 '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left' => 'display: flex;',
719 ],
720 ]
721 );
722
723
724 $this->add_control(
725 'content_icon_type',
726 [
727 'label' => __( 'Show type', 'wpdirectorykit' ),
728 'type' => \Elementor\Controls_Manager::SELECT,
729 'default' => 'font',
730 'options' => [
731 'font' => __( 'Font icon code', 'wpdirectorykit' ),
732 'image' => __( 'Image Icon', 'wpdirectorykit' ),
733 ],
734 ]
735 );
736
737 $selectors = array(
738 'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left',
739 'hover'=>'{{WRAPPER}} .wdk-locations-card-cover%1$s .wdk-locations-card-body .wdk-action-left',
740 );
741 $this->generate_renders_tabs($selectors, 'content_icon_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition']);
742
743 $this->add_control(
744 'content_icon_im_tab',
745 [
746 'label' => esc_html__('Image Icon', 'wpdirectorykit'),
747 'type' => Controls_Manager::HEADING,
748 'separator' => 'after',
749 ]
750 );
751
752 $selectors = array(
753 'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left img',
754 );
755 $this->generate_renders_tabs($selectors, 'content_icon_im_dynamic', ['image_size_control']);
756
757 $this->add_control(
758 'content_icon_f_tab',
759 [
760 'label' => esc_html__('Font Icon', 'wpdirectorykit'),
761 'type' => Controls_Manager::HEADING,
762 'separator' => 'after',
763 ]
764 );
765
766 $selectors = array(
767 'normal' => '{{WRAPPER}} .wdk-locations-card-cover .wdk-locations-card-body .wdk-action-left i',
768 );
769 $this->generate_renders_tabs($selectors, 'content_icon_f_dynamic', ['font-size']);
770
771
772 $this->end_controls_section();
773 }
774
775 private function generate_controls_content() {
776
777 }
778
779 public function enqueue_styles_scripts() {
780 wp_enqueue_style('wdk-locations-grid-cover');
781 }
782 }
783