PluginProbe
WP Directory Kit / 1.5.5
WP Directory Kit v1.5.5
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-listing-fields-section.php

wdk-listing-fields-section.php in WP Directory Kit 1.5.5, at elementor-elements/classes/wdk-listing-fields-section.php

1,043 lines 37.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
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkListingFieldsSection extends WdkElementorBase {
26
27 public $field_id = NULL;
28 public $fields_list = array();
29
30 public function __construct($data = array(), $args = null) {
31
32 \Elementor\Controls_Manager::add_tab(
33 'tab_conf',
34 esc_html__('Settings', 'wpdirectorykit')
35 );
36
37 \Elementor\Controls_Manager::add_tab(
38 'tab_layout',
39 esc_html__('Layout', 'wpdirectorykit')
40 );
41
42 \Elementor\Controls_Manager::add_tab(
43 'tab_content',
44 esc_html__('Main', 'wpdirectorykit')
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 /**
56 * Retrieve the list of categories the widget belongs to.
57 *
58 * Used to determine where to display the widget in the editor.
59 *
60 * Note that currently Elementor supports only one category.
61 * When multiple categories passed, Elementor uses the first one.
62 *
63 * @since 1.1.0
64 *
65 * @access public
66 *
67 * @return array Widget categories.
68 */
69 public function get_categories() {
70 return [ 'wdk-elementor-listing-preview' ];
71 }
72
73 /**
74 * Retrieve the widget name.
75 *
76 * @since 1.1.0
77 *
78 * @access public
79 *
80 * @return string Widget name.
81 */
82 public function get_name() {
83 return 'wdk-listing-fields-section';
84 }
85
86 /**
87 * Retrieve the widget title.
88 *
89 * @since 1.1.0
90 *
91 * @access public
92 *
93 * @return string Widget title.
94 */
95 public function get_title() {
96 return esc_html__('Wdk Fields Section', 'wpdirectorykit');
97 }
98
99 /**
100 * Retrieve the widget icon.
101 *
102 * @since 1.1.0
103 *
104 * @access public
105 *
106 * @return string Widget icon.
107 */
108 public function get_icon() {
109 return 'eicon-toggle';
110 }
111
112 /**
113 * Register the widget controls.
114 *
115 * Adds different input fields to allow the user to change and customize the widget settings.
116 *
117 * @since 1.1.0
118 *
119 * @access protected
120 */
121 protected function register_controls() {
122 $this->generate_controls_conf();
123 $this->generate_controls_layout();
124 $this->generate_controls_styles();
125 $this->generate_controls_content();
126
127 $this->insert_pro_message('1');
128 parent::register_controls();
129 }
130
131 /**
132 * Render the widget output on the frontend.
133 *
134 * Written in PHP and used to generate the final HTML.
135 *
136 * @since 1.1.0
137 *
138 * @access protected
139 */
140 protected function render() {
141
142 global $wdk_listing_id;
143
144 $this->data['id_element'] = $this->get_id();
145 $this->data['settings'] = $this->get_settings();
146 $this->data['wdk_listing_id'] = $wdk_listing_id;
147
148
149 $this->data['section_label'] = 'Example Section';
150 $this->data['sections_data'] = $this->WMVC->field_m->get_fields_section();
151 $this->data['section_data'] = array();
152
153 if(!empty($this->data['settings']['section_id'])){
154 $this->data['section_label'] = wdk_field_label($this->data['settings']['section_id']);
155 if(isset($this->data['sections_data'][$this->data['settings']['section_id']]))
156 $this->data['section_data'] = $this->data['sections_data'][$this->data['settings']['section_id']];
157 }
158
159 if(!empty($this->data['settings']['field_id']))
160 $this->data['field_label'] = wdk_field_label($this->data['settings']['field_id']);
161
162 $this->data['is_edit_mode']= false;
163 if(Plugin::$instance->editor->is_edit_mode()){
164 $this->data['is_edit_mode']= true;
165 if(empty($this->data['section_data'])){
166 echo '<p class="wdk_alert wdk_alert-danger">'.wdk_sprintf(esc_html__('Section #%1$s not found', 'wpdirectorykit'), $this->data['settings']['section_id']).'</p>';
167 return false;
168 }
169 } else {
170 if(empty($this->data['section_data'])){
171 return false;
172 }
173
174 /* return false if no content */
175 if($this->data['settings']['hide_onempty_complete'] == 'yes') {
176 $complete_empty = true;
177 foreach($this->data['section_data']['fields'] as $field) {
178
179 if(wdk_field_value('category_id', $wdk_listing_id) && wdk_depend_is_hidden_field(wmvc_show_data('idfield', $field), wdk_field_value('category_id', $wdk_listing_id))) {
180 continue;
181 }
182
183 if(!empty(wdk_field_value (wmvc_show_data('idfield', $field), $wdk_listing_id))){
184 $complete_empty = false;
185 break;
186 }
187 }
188
189 if($complete_empty)
190 return false;
191 }
192 }
193
194 echo $this->view('wdk-listing-fields-section', $this->data);
195 parent::render();
196 }
197
198
199 private function generate_controls_conf() {
200 $this->start_controls_section(
201 'tab_conf_main_section',
202 [
203 'label' => esc_html__('Main', 'wpdirectorykit'),
204 'tab' => '1',
205 ]
206 );
207
208 $WMVC = &wdk_get_instance();
209 $WMVC->model('field_m');
210
211 $sections_list = array('0' => esc_html__('Not Selected', 'wpdirectorykit'));
212 foreach($WMVC->field_m->get_sections() as $section_id => $section_label)
213 {
214 $sections_list[$section_id] = '#'.$section_id.' '.$section_label;
215 }
216
217 $this->add_control(
218 'section_id',
219 [
220 'label' => __( 'Section id', 'wpdirectorykit' ),
221 'type' => \Elementor\Controls_Manager::SELECT2,
222 'default' => '',
223 'options' => $sections_list,
224 'separator' => 'after',
225 ]
226 );
227
228 $this->add_control(
229 'label_suffix',
230 [
231 'label' => __( 'Label suffix', 'wpdirectorykit' ),
232 'type' => \Elementor\Controls_Manager::TEXT,
233 'default' => '',
234 ]
235 );
236
237 $this->add_control(
238 'label_prefix',
239 [
240 'label' => __( 'Label prefix', 'wpdirectorykit' ),
241 'type' => \Elementor\Controls_Manager::TEXT,
242 'default' => '',
243 ]
244 );
245
246 $this->add_control(
247 'hide_onempty',
248 [
249 'label' => __( 'Hide if empty field', 'wpdirectorykit' ),
250 'type' => \Elementor\Controls_Manager::SWITCHER,
251 'label_on' => __( 'True', 'wpdirectorykit' ),
252 'label_off' => __( 'False', 'wpdirectorykit' ),
253 'return_value' => 'yes',
254 'default' => '',
255 ]
256 );
257
258 $this->add_control(
259 'hide_onempty_checkbox',
260 [
261 'label' => __( 'Hide unchecked Checkboxes', 'wpdirectorykit' ),
262 'type' => \Elementor\Controls_Manager::SWITCHER,
263 'label_on' => __( 'True', 'wpdirectorykit' ),
264 'label_off' => __( 'False', 'wpdirectorykit' ),
265 'return_value' => 'yes',
266 'default' => 'yes',
267 ]
268 );
269
270 $this->add_control(
271 'hide_onempty_complete',
272 [
273 'label' => __( 'Hide section if empty all field', 'wpdirectorykit' ),
274 'type' => \Elementor\Controls_Manager::SWITCHER,
275 'label_on' => __( 'True', 'wpdirectorykit' ),
276 'label_off' => __( 'False', 'wpdirectorykit' ),
277 'return_value' => 'yes',
278 'default' => 'yes',
279 ]
280 );
281
282 $this->add_control(
283 'important_note',
284 [
285 'label' => '',
286 'type' => \Elementor\Controls_Manager::RAW_HTML,
287 'raw' => wdk_sprintf(__( 'Manager Fields <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_fields')),
288 'content_classes' => 'wdk_elementor_hint',
289 ]
290 );
291
292 $this->end_controls_section();
293
294 }
295
296
297 private function generate_controls_layout() {
298 /* TAB_STYLE */
299 $this->start_controls_section(
300 'section_form_style',
301 [
302 'label' => __( 'Grid', 'wpdirectorykit' ),
303 'tab' => Controls_Manager::TAB_STYLE,
304 ]
305 );
306
307 $this->add_responsive_control(
308 'field_layout',
309 [
310 'label' => __( 'Field Layout', 'wpdirectorykit' ),
311 'type' => Controls_Manager::SELECT,
312 'options' => [
313 '' => esc_html__('Default', 'wpdirectorykit'),
314 'reverse' => esc_html__('Reverse', 'wpdirectorykit'),
315 'column' => esc_html__('Column', 'wpdirectorykit'),
316 'column-reverse' => esc_html__('Column Reverse', 'wpdirectorykit'),
317 ],
318 'default' => '',
319 'separator' => 'before',
320 ]
321 );
322
323 $this->add_responsive_control(
324 'row_gap_col',
325 [
326 'label' => __( 'Columns', 'wpdirectorykit' ),
327 'type' => Controls_Manager::SELECT,
328 'options' => [
329 '' => esc_html__('Default', 'wpdirectorykit'),
330 'auto' => esc_html__('Auto', 'wpdirectorykit'),
331 '100%' => '1',
332 '50%' => '2',
333 'calc(100% / 3)' => '3',
334 '25%' => '4',
335 '20%' => '5',
336 'auto_flexible' => 'auto flexible',
337 ],
338 'selectors_dictionary' => [
339 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
340 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
341 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
342 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
343 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
344 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
345 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
346 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
347 ],
348 'selectors' => [
349 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
350 ],
351 'default' => 'calc(100% / 3)',
352 'separator' => 'before',
353 ]
354 );
355
356 $this->add_responsive_control(
357 'column_gap',
358 [
359 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
360 'type' => Controls_Manager::SLIDER,
361 'default' => [
362 'size' => 0,
363 ],
364 'range' => [
365 'px' => [
366 'min' => 0,
367 'max' => 60,
368 ],
369 ],
370 'selectors' => [
371 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
372 ],
373 ]
374 );
375
376 $this->add_responsive_control(
377 'row_gap',
378 [
379 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
380 'type' => Controls_Manager::SLIDER,
381 'default' => [
382 'size' => 10,
383 ],
384 'range' => [
385 'px' => [
386 'min' => 0,
387 'max' => 60,
388 ],
389 ],
390 'selectors' => [
391 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-bottom: {{SIZE}}{{UNIT}}; padding-top: {{SIZE}}{{UNIT}};',
392 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}}; margin-top: -{{SIZE}}{{UNIT}};',
393 ],
394 ]
395 );
396
397 $this->add_control(
398 'item_border_header',
399 [
400 'label' => __( 'Border', 'wpdirectorykit' ),
401 'type' => Controls_Manager::HEADING,
402 'separator' => 'before',
403 ]
404 );
405
406 $selectors = array(
407 'normal' => '{{WRAPPER}} .wdk-row .wdk-col',
408 );
409
410 $this->generate_renders_tabs($selectors, 'item_border', ['border']);
411
412 $this->add_control(
413 'field_group_position',
414 [
415 'label' => __( 'Positions', 'wpdirectorykit' ),
416 'type' => Controls_Manager::HEADING,
417 'separator' => 'before',
418 ]
419 );
420
421 $this->add_responsive_control(
422 'field_group_align_h',
423 [
424 'label' => __( 'Align Horizontal', 'wpdirectorykit' ),
425 'type' => Controls_Manager::CHOOSE,
426 'options' => [
427 'left' => [
428 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
429 'icon' => 'eicon-text-align-left',
430 ],
431 'center' => [
432 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
433 'icon' => 'eicon-text-align-center',
434 ],
435 'right' => [
436 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
437 'icon' => 'eicon-text-align-right',
438 ],
439 'justify' => [
440 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
441 'icon' => 'eicon-text-align-justify',
442 ],
443 ],
444 'render_type' => 'template',
445 'selectors_dictionary' => [
446 'left' => 'justify-content: flex-start;',
447 'center' => 'justify-content: center;',
448 'right' => 'justify-content: flex-end;',
449 'justify' => 'justify-content: space-between;',
450 ],
451 'selectors' => [
452 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};',
453 ],
454 'conditions' => [
455 'terms' => [
456 [
457 'name' => 'field_layout',
458 'operator' => '==',
459 'value' => '',
460 ]
461 ],
462 ],
463 ]
464 );
465
466 $this->add_responsive_control(
467 'field_group_align_h_reverse',
468 [
469 'label' => __( 'Align Horizontal', 'wpdirectorykit' ),
470 'type' => Controls_Manager::CHOOSE,
471 'options' => [
472 'left' => [
473 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
474 'icon' => 'eicon-text-align-left',
475 ],
476 'center' => [
477 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
478 'icon' => 'eicon-text-align-center',
479 ],
480 'right' => [
481 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
482 'icon' => 'eicon-text-align-right',
483 ],
484 'justify' => [
485 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
486 'icon' => 'eicon-text-align-justify',
487 ],
488 ],
489 'render_type' => 'template',
490 'selectors_dictionary' => [
491 'left' => 'justify-content: flex-end;',
492 'center' => 'justify-content: center;',
493 'right' => 'justify-content: flex-start;',
494 'justify' => 'justify-content: space-between;',
495 ],
496 'selectors' => [
497 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};',
498 ],
499 'conditions' => [
500 'terms' => [
501 [
502 'name' => 'field_layout',
503 'operator' => '==',
504 'value' => 'reverse',
505 ]
506 ],
507 ],
508 ]
509 );
510
511 $this->add_responsive_control(
512 'field_group_align_v',
513 [
514 'label' => __( 'Align Vertical', 'wpdirectorykit' ),
515 'type' => Controls_Manager::CHOOSE,
516 'options' => [
517 'left' => [
518 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
519 'icon' => 'eicon-v-align-top',
520 ],
521 'center' => [
522 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
523 'icon' => 'eicon-v-align-middle',
524 ],
525 'right' => [
526 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
527 'icon' => 'eicon-v-align-bottom',
528 ]
529 ],
530 'default' => 'center',
531 'render_type' => 'template',
532 'selectors_dictionary' => [
533 'left' => 'align-items: flex-start;',
534 'center' => 'align-items: center;',
535 'right' => 'align-items: flex-end;',
536 ],
537 'selectors' => [
538 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};',
539 ],
540 'conditions' => [
541 'terms' => [
542 [
543 'name' => 'field_group_icon_enable',
544 'operator' => '==',
545 'value' => 'yes',
546 ]
547 ],
548 ],
549 ]
550 );
551 $this->end_controls_section();
552
553 }
554
555 private function generate_controls_styles() {
556
557 $this->start_controls_section(
558 'field_group',
559 [
560 'label' => esc_html__('Field Icon', 'wpdirectorykit'),
561 'tab' => Controls_Manager::TAB_STYLE,
562 ]
563 );
564
565 $this->add_responsive_control(
566 'field_group_icon_enable',
567 [
568 'label' => esc_html__( 'Enable Icon', 'wpdirectorykit' ),
569 'type' => \Elementor\Controls_Manager::SWITCHER,
570 'label_on' => __( 'On', 'wpdirectorykit' ),
571 'label_off' => __( 'Off', 'wpdirectorykit' ),
572 'return_value' => 'yes',
573 'default' => 'yes',
574 ]
575 );
576
577 $this->add_responsive_control (
578 'field_group_icon_max_heigth',
579 [
580 'label' => esc_html__('Max Height', 'wpdirectorykit'),
581 'type' => Controls_Manager::SLIDER,
582 'range' => [
583 'px' => [
584 'min' => 10,
585 'max' => 1500,
586 ],
587 'vw' => [
588 'min' => 0,
589 'max' => 100,
590 ],
591 '%' => [
592 'min' => 0,
593 'max' => 100,
594 ],
595 ],
596 'size_units' => [ 'px', 'vw','%' ],
597 'default' => [
598 'unit' => 'px',
599 'size' => 18,
600 ],
601 'selectors' => [
602 '{{WRAPPER}} .field_icon .wdk-icon' => 'max-height: {{SIZE}}{{UNIT}}',
603 ],
604 'conditions' => [
605 'terms' => [
606 [
607 'name' => 'field_group_icon_enable',
608 'operator' => '==',
609 'value' => 'yes',
610 ]
611 ],
612 ],
613 ]
614 );
615
616 $this->add_responsive_control (
617 'field_group_icon_max_width',
618 [
619 'label' => esc_html__('Max Width', 'wpdirectorykit'),
620 'type' => Controls_Manager::SLIDER,
621 'range' => [
622 'px' => [
623 'min' => 10,
624 'max' => 1500,
625 ],
626 'vw' => [
627 'min' => 0,
628 'max' => 100,
629 ],
630 '%' => [
631 'min' => 0,
632 'max' => 100,
633 ],
634 ],
635 'size_units' => [ 'px', 'vw','%' ],
636 'default' => [
637 'unit' => 'px',
638 'size' => 18,
639 ],
640 'selectors' => [
641 '{{WRAPPER}} .field_icon .wdk-icon' => 'max-width: {{SIZE}}{{UNIT}}',
642 ],
643 'conditions' => [
644 'terms' => [
645 [
646 'name' => 'field_group_icon_enable',
647 'operator' => '==',
648 'value' => 'yes',
649 ]
650 ],
651 ],
652 ]
653 );
654
655 $this->add_responsive_control(
656 'field_group_icon',
657 [
658 'label' => esc_html__( 'Margin Icon', 'wpdirectorykit' ),
659 'type' => Controls_Manager::DIMENSIONS,
660 'size_units' => [ 'px', 'em', '%' ],
661 'selectors' => [
662 '{{WRAPPER}} .field_icon .wdk-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
663 ],
664 'default' => [
665 'top' => 0,
666 'right' => 4,
667 'bottom' => 0,
668 'left' => 0,
669 ],
670 'conditions' => [
671 'terms' => [
672 [
673 'name' => 'field_group_icon_enable',
674 'operator' => '==',
675 'value' => 'yes',
676 ]
677 ],
678 ],
679 ]
680 );
681
682 $this->add_responsive_control(
683 'field_group_icon_position',
684 [
685 'label' => __( 'Icon Position', 'wpdirectorykit' ),
686 'type' => Controls_Manager::CHOOSE,
687 'options' => [
688 'left' => [
689 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
690 'icon' => 'eicon-text-align-left',
691 ],
692 'top' => [
693 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
694 'icon' => 'eicon-v-align-top',
695 ],
696 'right' => [
697 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
698 'icon' => 'eicon-text-align-right',
699 ],
700 'bottom' => [
701 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
702 'icon' => 'eicon-v-align-bottom',
703 ],
704 ],
705 'render_type' => 'template',
706 'selectors_dictionary' => [
707 'left' => 'width: auto;',
708 'top' => 'width: 100%;',
709 'right' => 'width:auto;order: 4;',
710 'bottom' => 'width:100%;order: 4;',
711 ],
712 'selectors' => [
713 '{{WRAPPER}} .field_icon' => '{{VALUE}};',
714 ],
715 'conditions' => [
716 'terms' => [
717 [
718 'name' => 'field_group_icon_enable',
719 'operator' => '==',
720 'value' => 'yes',
721 ],
722 [
723 'name' => 'field_layout',
724 'operator' => '==',
725 'value' => '',
726 ]
727 ],
728 ],
729 ]
730 );
731
732 $this->add_responsive_control(
733 'field_group_icon_position_reverse',
734 [
735 'label' => __( 'Icon Position', 'wpdirectorykit' ),
736 'type' => Controls_Manager::CHOOSE,
737 'options' => [
738 'left' => [
739 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
740 'icon' => 'eicon-text-align-left',
741 ],
742 'top' => [
743 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
744 'icon' => 'eicon-v-align-top',
745 ],
746 'right' => [
747 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
748 'icon' => 'eicon-text-align-right',
749 ],
750 'bottom' => [
751 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
752 'icon' => 'eicon-v-align-bottom',
753 ],
754 ],
755 'render_type' => 'template',
756 'selectors_dictionary' => [
757 'left' => 'width: auto;order: 4;',
758 'top' => 'width: 100%;order: 1;',
759 'right' => 'width:auto;order: 1;',
760 'bottom' => 'width:100%;order: 4;',
761 ],
762 'selectors' => [
763 '{{WRAPPER}} .field_icon' => '{{VALUE}};',
764 ],
765 'conditions' => [
766 'terms' => [
767 [
768 'name' => 'field_group_icon_enable',
769 'operator' => '==',
770 'value' => 'yes',
771 ],
772 [
773 'name' => 'field_layout',
774 'operator' => '==',
775 'value' => 'reverse',
776 ]
777 ],
778 ],
779 ]
780 );
781
782 $this->add_responsive_control(
783 'field_group_icon_position_align',
784 [
785 'label' => __( 'Icon Align', 'wpdirectorykit' ),
786 'type' => Controls_Manager::CHOOSE,
787 'options' => [
788 'left' => [
789 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
790 'icon' => 'eicon-text-align-left',
791 ],
792 'center' => [
793 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
794 'icon' => 'eicon-text-align-center',
795 ],
796 'right' => [
797 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
798 'icon' => 'eicon-text-align-right',
799 ],
800 ],
801 'render_type' => 'template',
802 'selectors_dictionary' => [
803 'left' => 'text-align:left',
804 'center' => 'text-align:center',
805 'right' => 'text-align:right',
806 ],
807 'selectors' => [
808 '{{WRAPPER}} .field_icon' => '{{VALUE}};',
809 ],
810 'conditions' => [
811 'terms' => [
812 [
813 'name' => 'field_group_icon_enable',
814 'operator' => '==',
815 'value' => 'yes',
816 ],
817 ],
818 ],
819 ]
820 );
821
822 $this->end_controls_section();
823
824 /* dynamic */
825 $items = [
826 [
827 'key'=>'section_title',
828 'label'=> esc_html__('Section Title', 'wpdirectorykit'),
829 'selector'=>'.section-title',
830 'options'=>'full',
831 ],
832 [
833 'key'=>'field_label',
834 'label'=> esc_html__('Field Label', 'wpdirectorykit'),
835 'selector'=>'.field_label',
836 'options'=>['margin','typo','color','padding','transition'],
837 ],
838 [
839 'key'=>'field_prefix',
840 'label'=> esc_html__('Field Prefix', 'wpdirectorykit'),
841 'selector'=>'.field_value .prefix',
842 'options'=>['margin','typo','color','padding','transition'],
843 ],
844 [
845 'key'=>'field_suffix',
846 'label'=> esc_html__('Field Suffix', 'wpdirectorykit'),
847 'selector'=>'.field_value .suffix',
848 'options'=>['margin','typo','color','padding','transition'],
849 ],
850 [
851 'key'=>'field_value',
852 'label'=> esc_html__('Field Value', 'wpdirectorykit'),
853 'selector'=>'.field_value .value',
854 'options'=>['margin','typo','color','padding','transition'],
855 ]
856 ];
857
858 foreach ($items as $item) {
859 $this->start_controls_section(
860 $item['key'].'_section',
861 [
862 'label' => $item['label'],
863 'tab' => 'tab_layout'
864 ]
865 );
866
867 $this->add_responsive_control(
868 $item['key'].'_hide',
869 [
870 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
871 'type' => Controls_Manager::SWITCHER,
872 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
873 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
874 'return_value' => 'none',
875 'default' => '',
876 'selectors' => [
877 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
878 ],
879 ]
880 );
881
882 $selectors = array(
883 'normal' => '{{WRAPPER}} '.$item['selector'],
884 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
885 );
886 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
887
888 $this->end_controls_section();
889 /* END special for some elements */
890 }
891
892 $this->start_controls_section(
893 'field_checkbox_icon',
894 [
895 'label' => esc_html__('Checkbox', 'wpdirectorykit'),
896 'tab' => Controls_Manager::TAB_STYLE,
897 ]
898 );
899
900 $this->add_responsive_control(
901 'field_checkbox_icon_success_header',
902 [
903 'label' => esc_html__('Success checkbox', 'wpdirectorykit'),
904 'type' => Controls_Manager::HEADING,
905 'separator' => 'before',
906 ]
907 );
908
909 $this->add_responsive_control(
910 'field_checkbox_hide',
911 [
912 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
913 'type' => Controls_Manager::SWITCHER,
914 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
915 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
916 'return_value' => 'none',
917 'default' => '',
918 'selectors' => [
919 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col.reverse.CHECKBOX .field_value' => 'display: {{VALUE}};',
920 ],
921 ]
922 );
923
924 $this->add_responsive_control(
925 'field_checkbox_position',
926 [
927 'label' => __( 'Columns', 'wpdirectorykit' ),
928 'type' => Controls_Manager::SELECT,
929 'options' => [
930 'left' => esc_html__('Left', 'wpdirectorykit'),
931 'right' => esc_html__('Right', 'wpdirectorykit'),
932 ],
933 'selectors_dictionary' => [
934 'left' => 'order:1',
935 'right' => 'order: 3',
936 ],
937 'selectors' => [
938 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col.reverse.CHECKBOX .field_value' => '{{UNIT}}',
939 ],
940 'default' => 'left',
941 'separator' => 'before',
942 'conditions' => [
943 'terms' => [
944 [
945 'name' => 'field_layout',
946 'operator' => '==',
947 'value' => '',
948 ]
949 ],
950 ],
951 ]
952 );
953
954 $this->add_responsive_control(
955 'field_checkbox_position_reverse',
956 [
957 'label' => __( 'Columns', 'wpdirectorykit' ),
958 'type' => Controls_Manager::SELECT,
959 'options' => [
960 'left' => esc_html__('Left', 'wpdirectorykit'),
961 'right' => esc_html__('Right', 'wpdirectorykit'),
962 ],
963 'selectors_dictionary' => [
964 'left' => 'order:3',
965 'right' => 'order: 1',
966 ],
967 'selectors' => [
968 '{{WRAPPER}} .wdk-listing-fields-section .wdk-col.reverse.CHECKBOX .field_value' => '{{UNIT}}',
969 ],
970 'default' => 'left',
971 'separator' => 'before',
972 'conditions' => [
973 'terms' => [
974 [
975 'name' => 'field_layout',
976 'operator' => '==',
977 'value' => 'reverse',
978 ]
979 ],
980 ],
981 ]
982 );
983
984 $this->add_control (
985 'field_checkbox_icon_success',
986 [
987 'label' => esc_html__('Icon', 'wpdirectorykit'),
988 'type' => Controls_Manager::ICONS,
989 'label_block' => true,
990 'default' => [
991 'value' => 'fa fa-check',
992 'library' => 'solid',
993 ],
994 ]
995 );
996
997 $selectors = array(
998 'normal' => '{{WRAPPER}} .field_checkbox_success',
999 );
1000 $this->generate_renders_tabs($selectors, 'field_checkbox_icon_success_dynamic', 'full');
1001
1002
1003 $this->add_responsive_control(
1004 'field_checkbox_icon_unsuccess_header',
1005 [
1006 'label' => esc_html__('Unsuccess checkbox', 'wpdirectorykit'),
1007 'type' => Controls_Manager::HEADING,
1008 'separator' => 'before',
1009 ]
1010 );
1011
1012 $this->add_control(
1013 'field_checkbox_icon_unsuccess',
1014 [
1015 'label' => esc_html__('Icon', 'wpdirectorykit'),
1016 'type' => Controls_Manager::ICONS,
1017 'label_block' => true,
1018 'default' => [
1019 'value' => 'fa fa-close',
1020 'library' => 'solid',
1021 ],
1022 ]
1023 );
1024
1025 $selectors = array(
1026 'normal' => '{{WRAPPER}} .field_checkbox_unsuccess',
1027 );
1028
1029 $this->generate_renders_tabs($selectors, 'field_checkbox_icon_unsuccess_dynamic', 'full');
1030
1031 $this->end_controls_section();
1032 }
1033
1034
1035 private function generate_controls_content() {
1036
1037 }
1038
1039 public function enqueue_styles_scripts() {
1040 wp_enqueue_style('wdk-listing-fields-section');
1041 }
1042 }
1043