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-listing-fields-section.php

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

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