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-field-value.php

wdk-field-value.php in WP Directory Kit 1.5.9, at elementor-elements/classes/wdk-field-value.php

1,230 lines 54.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 WdkFieldValue extends WdkElementorBase
26 {
27
28 public $field_id = NULL;
29 public $fields_list = array();
30 public $fields_list_files = array();
31
32 public function __construct($data = array(), $args = null)
33 {
34
35 \Elementor\Controls_Manager::add_tab(
36 'tab_conf',
37 esc_html__('Settings', 'wpdirectorykit')
38 );
39
40 \Elementor\Controls_Manager::add_tab(
41 'tab_layout',
42 esc_html__('Layout', 'wpdirectorykit')
43 );
44
45 \Elementor\Controls_Manager::add_tab(
46 'tab_content',
47 esc_html__('Main', 'wpdirectorykit')
48 );
49
50 add_action('elementor/editor/after_enqueue_styles', function () {
51 wp_add_inline_style('elementor-editor', '.elementor-control-content select option[value*="section"]{color:#fff;background:#000}');
52 });
53
54 if ($this->is_edit_mode_load()) {
55 $this->enqueue_styles_scripts();
56 }
57
58 parent::__construct($data, $args);
59 }
60
61 /**
62 * Retrieve the list of categories the widget belongs to.
63 *
64 * Used to determine where to display the widget in the editor.
65 *
66 * Note that currently Elementor supports only one category.
67 * When multiple categories passed, Elementor uses the first one.
68 *
69 * @since 1.1.0
70 *
71 * @access public
72 *
73 * @return array Widget categories.
74 */
75 public function get_categories()
76 {
77 return ['wdk-elementor-listing-preview'];
78 }
79
80 /**
81 * Retrieve the widget name.
82 *
83 * @since 1.1.0
84 *
85 * @access public
86 *
87 * @return string Widget name.
88 */
89 public function get_name()
90 {
91 return 'wdk-field-value';
92 }
93
94 /**
95 * Retrieve the widget title.
96 *
97 * @since 1.1.0
98 *
99 * @access public
100 *
101 * @return string Widget title.
102 */
103 public function get_title()
104 {
105 return esc_html__('Wdk Field Value', 'wpdirectorykit');
106 }
107
108 /**
109 * Retrieve the widget icon.
110 *
111 * @since 1.1.0
112 *
113 * @access public
114 *
115 * @return string Widget icon.
116 */
117 public function get_icon()
118 {
119 return 'eicon-product-meta';
120 }
121
122 /**
123 * Register the widget controls.
124 *
125 * Adds different input fields to allow the user to change and customize the widget settings.
126 *
127 * @since 1.1.0
128 *
129 * @access protected
130 */
131 protected function register_controls()
132 {
133 $this->generate_controls_conf();
134 $this->generate_controls_layout();
135 $this->generate_controls_styles();
136 $this->generate_controls_content();
137
138 $this->generate_controls_styles_files();
139
140 $this->insert_pro_message('1');
141 parent::register_controls();
142 }
143
144 /**
145 * Render the widget output on the frontend.
146 *
147 * Written in PHP and used to generate the final HTML.
148 *
149 * @since 1.1.0
150 *
151 * @access protected
152 */
153 protected function render()
154 {
155 parent::render();
156 global $wdk_listing_id;
157
158 $this->data['id_element'] = $this->get_id();
159 $this->data['settings'] = $this->get_settings();
160
161 $this->data['field_value'] = 'Example Value';
162 $this->data['field_prefix'] = 'prefix';
163 $this->data['field_suffix'] = 'suffix';
164 if (!empty($this->data['settings']['field_id'])) {
165 if (strpos($this->data['settings']['field_id'], '__') !== FALSE) {
166 $this->data['settings']['field_id'] = substr($this->data['settings']['field_id'], strpos($this->data['settings']['field_id'], '__') + 2);
167 }
168
169 if (!Plugin::$instance->editor->is_edit_mode() && !empty($wdk_listing_id)) {
170 if (wdk_field_option($this->data['settings']['field_id'], 'field_type') == "CHECKBOX") {
171 if (wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id) == 1) {
172 $this->data['field_value'] = '<span class="field_checkbox_success">' . $this->generate_icon($this->data['settings']['field_checkbox_icon_success']) . '</span>';
173 } else {
174 $this->data['field_value'] = '<span class="field_checkbox_unsuccess">' . $this->generate_icon($this->data['settings']['field_checkbox_icon_unsuccess']) . '</span>';
175 }
176 } else if (wdk_field_option($this->data['settings']['field_id'], 'field_type') == "INPUTBOX") {
177
178 // Dynamic field values are registered in the translation catalog separately.
179 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
180 $this->data['field_value'] = __(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id, wdk_field_option($this->data['settings']['field_id'], 'empty_value')), 'wpdirectorykit');
181
182 if (strpos($this->data['field_value'], 'vimeo.com') !== FALSE) {
183 $this->data['field_value'] = wp_oembed_get($this->data['field_value'], array("width" => "800", "height" => "450"));
184 } elseif (strpos($this->data['field_value'], 'watch?v=') !== FALSE) {
185 $embed_code = substr($this->data['field_value'], strpos($this->data['field_value'], 'watch?v=') + 8);
186 $this->data['field_value'] = wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));
187 } elseif (strpos($this->data['field_value'], 'youtube.com/shorts/') !== FALSE) {
188 $embed_code = substr($this->data['field_value'], strpos($this->data['field_value'], 'shorts') + 7);
189 $this->data['field_value'] = wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));
190 } elseif (strpos($this->data['field_value'], 'youtu.be/') !== FALSE) {
191 $embed_code = substr($this->data['field_value'], strpos($this->data['field_value'], 'youtu.be/') + 9);
192 $this->data['field_value'] = wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));
193 } elseif (filter_var($this->data['field_value'], FILTER_VALIDATE_URL) !== FALSE && preg_match('/\.(mp4|flv|wmw|ogv|webm|ogg)$/i', $this->data['field_value'])) {
194 $this->data['field_value'] = '<video src="' . $this->data['field_value'] . '" controls></video> ';
195 } elseif (filter_var($this->data['field_value'], FILTER_VALIDATE_EMAIL) !== FALSE) {
196 if (wmvc_show_data('link_value', $this->data['settings']) == 'value') {
197 $this->data['field_value'] = '<a class="value" href="mailto:' . $this->data['field_value'] . '">' . $this->data['field_value'] . '</a>';
198 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'label') {
199 $this->data['field_value'] = '<a class="value" href="mailto:' . $this->data['field_value'] . '">' . wdk_field_label($this->data['settings']['field_id']) . '</a>';
200 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'icon' && wdk_field_option($this->data['settings']['field_id'], 'icon_id')) {
201 $this->data['field_value'] = '<a class="value" href="mailto:' . $this->data['field_value'] . '"><img src="' . esc_url(wdk_image_src(array('icon_id' => wdk_field_option($this->data['settings']['field_id'], 'icon_id')), 'full', NULL, 'icon_id')) . '"></a>';
202 } else {
203 $this->data['field_value'] = '<a class="value" href="mailto:' . $this->data['field_value'] . '">' . wdk_field_label($this->data['settings']['field_id']) . '</a>';
204 }
205 } elseif (filter_var($this->data['field_value'], FILTER_VALIDATE_URL) !== FALSE) {
206 if (wmvc_show_data('link_value', $this->data['settings']) == 'value') {
207 $this->data['field_value'] = '<a class="value" target="_blank" href="' . $this->data['field_value'] . '">' . $this->data['field_value'] . '</a>';
208 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'label') {
209 $this->data['field_value'] = '<a class="value" target="_blank" href="' . $this->data['field_value'] . '">' . wdk_field_label($this->data['settings']['field_id']) . '</a>';
210 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'icon' && wdk_field_option($this->data['settings']['field_id'], 'icon_id')) {
211 $this->data['field_value'] = '<a class="value" target="_blank" href="' . $this->data['field_value'] . '"><img src="' . esc_url(wdk_image_src(array('icon_id' => wdk_field_option($this->data['settings']['field_id'], 'icon_id')), 'full', NULL, 'icon_id')) . '"></a>';
212 } else {
213 $this->data['field_value'] = '<a class="value" target="_blank" href="' . $this->data['field_value'] . '">' . wdk_field_label($this->data['settings']['field_id']) . '</a>';
214 }
215 } elseif (wdk_field_option(wmvc_show_data('idfield', $this->data['settings']['field_id']), 'validation') == 'is_phone') {
216 $this->data['field_value'] = '<a class="value" href="tel:' . wdk_filter_phone($this->data['field_value']) . '">' . $this->_generate_label() . '</a>';
217 } elseif (wdk_field_option(wmvc_show_data('idfield', $this->data['settings']['field_id']), 'validation') == 'is_phone|wdk_viber') {
218 $this->data['field_value'] = '<a class="value" href="viber://chat?number=' . wdk_filter_viber_phone($this->data['field_value']) . '">' . $this->_generate_label() . '</a>';
219 } elseif (wdk_field_option(wmvc_show_data('idfield', $this->data['settings']['field_id']), 'validation') == 'is_phone|wdk_whatsapp') {
220 $this->data['field_value'] = '<a class="value" target="_blank" href="//wa.me/' . wdk_filter_phone($this->data['field_value']) . '">' . $this->_generate_label() . '</a>';
221 }
222 } elseif ($this->data['settings']['field_id'] == 'category_id') {
223 if (wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id)) {
224 $this->WMVC->model('category_m');
225 $tree_data = $this->WMVC->category_m->get(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id), TRUE);
226 $this->data['field_value'] = wmvc_show_data('category_title', $tree_data);
227
228 if (get_option('wdk_multi_categories_other_enable', FALSE))
229 if (wdk_field_value('categories_list', $wdk_listing_id)) {
230 $other_categories = wdk_generate_other_categories_fast(wdk_field_value('categories_list', $wdk_listing_id));
231 if (!empty($other_categories))
232 $this->data['field_value'] .= ', ' . join(', ', $other_categories);
233 }
234
235 // Dynamic field values are registered in the translation catalog separately.
236 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
237 $this->data['field_value'] = __($this->data['field_value'], 'wpdirectorykit');
238 }
239 } elseif ($this->data['settings']['field_id'] == 'location_id') {
240 if (wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id)) {
241 $this->WMVC->model('location_m');
242 $tree_data = $this->WMVC->location_m->get(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id), TRUE);
243 $this->data['field_value'] = wmvc_show_data('location_title', $tree_data);
244
245 if (get_option('wdk_multi_locations_other_enable', FALSE))
246 if (wdk_field_value('locations_list', $wdk_listing_id)) {
247 $other_locations = wdk_generate_other_locations_fast(wdk_field_value('locations_list', $wdk_listing_id));
248 if (!empty($other_locations))
249 $this->data['field_value'] .= ', ' . join(', ', $other_locations);
250 }
251
252 // Dynamic field values are registered in the translation catalog separately.
253 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
254 $this->data['field_value'] = __($this->data['field_value'], 'wpdirectorykit');
255 }
256 } elseif (wdk_field_option($this->data['settings']['field_id'], 'field_type') == "DATE") {
257 // Dynamic field values are registered in the translation catalog separately.
258 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
259 $this->data['field_value'] = __(wdk_get_date(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id)), 'wpdirectorykit');
260 } elseif (strpos($this->data['settings']['field_id'], 'date') !== FALSE) {
261 // Dynamic field values are registered in the translation catalog separately.
262 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
263 $this->data['field_value'] = __(wdk_get_date(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id)), 'wpdirectorykit');
264 } elseif (
265 wdk_field_option($this->data['settings']['field_id'], 'field_type') == "TEXTAREA" ||
266 $this->data['settings']['field_id'] == 'post_content'
267 ) {
268 global $wp_embed;
269 // Dynamic field values are registered in the translation catalog separately.
270 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
271 $this->data['field_value'] = wpautop(__(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id), 'wpdirectorykit'));
272 $this->data['field_value'] = html_entity_decode($wp_embed->autoembed($this->data['field_value']));
273 } elseif (
274 wdk_field_option($this->data['settings']['field_id'], 'field_type') == "FILEUPLOAD"
275 ) {
276 $this->data['field_value'] = wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id);
277 $this->data['field_value'] = wdk_files_data($this->data['field_value'], 'full');
278
279
280 wp_enqueue_style('wdk-field-files');
281 wp_enqueue_style('blueimp-gallery');
282 wp_enqueue_script('blueimp-gallery');
283 wp_enqueue_script('wdk-blueimp-gallery');
284 } else {
285 // Dynamic field values are registered in the translation catalog separately.
286 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
287 $this->data['field_value'] = __(wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id, wdk_field_option($this->data['settings']['field_id'], 'empty_value')), 'wpdirectorykit');
288 }
289 } else {
290 if (wdk_field_option($this->data['settings']['field_id'], 'field_type') == "CHECKBOX") {
291 $this->data['field_value'] = '<span class="field_checkbox_success">' . $this->generate_icon($this->data['settings']['field_checkbox_icon_success']) . '</span>';
292 } elseif ($this->data['settings']['field_id'] == 'post_title') {
293 $this->data['field_value'] = esc_html__('Example', 'wpdirectorykit') . ' ' . esc_html__('Title', 'wpdirectorykit');
294 } elseif ($this->data['settings']['field_id'] == 'address') {
295 $this->data['field_value'] = esc_html__('Example', 'wpdirectorykit') . ' ' . esc_html__('Address', 'wpdirectorykit');
296 } elseif ($this->data['settings']['field_id'] == 'post_content') {
297 $this->data['field_value'] = esc_html__('Example', 'wpdirectorykit') . ' ' . esc_html__('Content', 'wpdirectorykit');
298 } elseif ($this->data['settings']['field_id'] == 'post_title') {
299 $this->data['field_value'] = esc_html__('Example', 'wpdirectorykit') . ' ' . esc_html__('Title', 'wpdirectorykit');
300 } elseif ($this->data['settings']['field_id'] == 'counter_views') {
301 $this->data['field_label'] = esc_html__('Example', 'wpdirectorykit') . ' ' . esc_html__('Views counter', 'wpdirectorykit');
302 } elseif (wdk_field_option($this->data['settings']['field_id'], 'field_type') == 'FILEUPLOAD') {
303 $this->data['field_value'] = array_fill(0, 6, wdk_placeholder_image_src());
304 } else {
305 $this->data['field_value'] = esc_html__('Example', 'wpdirectorykit') . ' ' . wdk_field_label($this->data['settings']['field_id']);
306 }
307 }
308 $this->data['field_prefix'] = wdk_field_option($this->data['settings']['field_id'], 'prefix');
309 $this->data['field_suffix'] = wdk_field_option($this->data['settings']['field_id'], 'suffix');
310 }
311
312 $this->data['is_edit_mode'] = false;
313 if (Plugin::$instance->editor->is_edit_mode() || empty($wdk_listing_id)) {
314 $this->data['is_edit_mode'] = true;
315 if (is_intval($this->data['settings']['field_id']) && wdk_field_option($this->data['settings']['field_id'], 'is_visible_frontend') != 1) {
316 $this->data['field_value'] .= ' <span class="dashicons dashicons-hidden" style="color:red"></span>';
317 }
318 } else {
319 if (is_intval($this->data['settings']['field_id']) && wdk_field_option($this->data['settings']['field_id'], 'is_visible_frontend') != 1) {
320 return false;
321 }
322
323 if (wdk_field_value('category_id', $wdk_listing_id) && wdk_depend_is_hidden_field($this->data['settings']['field_id'], wdk_field_value('category_id', $wdk_listing_id))) {
324 return false;
325 }
326
327 /* return false if no content */
328 if ($this->data['settings']['hide_onempty'] == 'yes' && wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id) == '')
329 return false;
330
331 $this->data['field_prefix'] = apply_filters('wpdirectorykit/listing/field/prefix', $this->data['field_prefix'], $this->data['settings']['field_id']);
332 $this->data['field_suffix'] = apply_filters('wpdirectorykit/listing/field/suffix', $this->data['field_suffix'], $this->data['settings']['field_id']);
333
334 /* price format implement */
335 if (function_exists('run_wdk_currency_conversion') && wdk_currencies_is_price_field($this->data['settings']['field_id'])) {
336 /* if currency_conversion and field is price */
337 $value = wp_strip_all_tags(apply_filters('wpdirectorykit/listing/field/value', wdk_filter_decimal($this->data['field_value']), $this->data['settings']['field_id'], FALSE));
338 $this->data['field_value'] = esc_html(wdk_number_format_i18n($value));
339 } elseif (wdk_field_option($this->data['settings']['field_id'], 'is_price_format') && wdk_field_option($this->data['settings']['field_id'], 'field_type') == 'NUMBER' && !empty($this->data['field_value'])) {
340 /* if field enabled is_price_format and field type is number*/
341 $value = wp_strip_all_tags(apply_filters('wpdirectorykit/listing/field/value', wdk_filter_decimal($this->data['field_value']), $this->data['settings']['field_id'], FALSE));
342 $this->data['field_value'] = esc_html(wdk_number_format_i18n($value));
343 } else {
344 /* without number format */
345 $this->data['field_value'] = apply_filters('wpdirectorykit/listing/field/value', $this->data['field_value'], $this->data['settings']['field_id']);
346 }
347 }
348
349 $this->view('wdk-field-value', $this->data, true);
350 }
351
352 private function _generate_label()
353 {
354 if (wmvc_show_data('link_value', $this->data['settings']) == 'value') {
355 return $this->data['field_value'];
356 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'label') {
357 return wdk_field_label($this->data['settings']['field_id']);
358 } else if (wmvc_show_data('link_value', $this->data['settings']) == 'icon' && wdk_field_option($this->data['settings']['field_id'], 'icon_id')) {
359 return '<img src="' . esc_url(wdk_image_src(array('icon_id' => wdk_field_option($this->data['settings']['field_id'], 'icon_id')), 'full', NULL, 'icon_id')) . '">';
360 } else {
361 return wdk_field_label($this->data['settings']['field_id']);
362 }
363 }
364
365
366 private function generate_controls_conf()
367 {
368 $this->start_controls_section(
369 'tab_conf_main_section',
370 [
371 'label' => esc_html__('Main', 'wpdirectorykit'),
372 'tab' => '1',
373 ]
374 );
375
376
377 $this->add_control(
378 'html_tag',
379 [
380 'label' => __('HTML Tag', 'wpdirectorykit'),
381 'type' => \Elementor\Controls_Manager::SELECT,
382 'default' => 'span',
383 'options' => array(
384 '' => __('Default', 'wpdirectorykit'),
385 'h1' => 'H1',
386 'h2' => 'H2',
387 'h3' => 'H3',
388 'h4' => 'H4',
389 'h5' => 'H5',
390 'h6' => 'H6',
391 'span' => 'span',
392 'address' => 'address',
393 'strong' => 'strong',
394 'div' => 'div',
395 'p' => 'p',
396 'q' => 'q',
397 'time' => 'time',
398 ),
399 ]
400 );
401
402 $fields_data = wdk_cached_field_get();
403 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
404 $fields_number_types = array();
405
406 $fields_list['section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
407 $fields_list['idlisting'] = esc_html__('Id listing', 'wpdirectorykit');
408 $fields_list['post_id'] = esc_html__('Post Id', 'wpdirectorykit');
409 $fields_list['counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
410 $fields_list['lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
411 $fields_list['lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
412 $fields_list['date'] = esc_html__('Date', 'wpdirectorykit');
413 $fields_list['date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
414 $fields_list['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
415 $fields_list['post_content'] = esc_html__('WP Content', 'wpdirectorykit');
416 $fields_list['address'] = esc_html__('Address', 'wpdirectorykit');
417 $fields_list['category_id'] = esc_html__('Category', 'wpdirectorykit');
418 $fields_list['location_id'] = esc_html__('Location', 'wpdirectorykit');
419
420 foreach ($fields_data as $field) {
421 if (wmvc_show_data('field_type', $field) == 'SECTION') {
422 $fields_list['section__' . wmvc_show_data('idfield', $field)] = '-- ' . esc_html__('Section', 'wpdirectorykit') . ' ' . wmvc_show_data('field_label', $field) . ' --';
423 } else {
424 $fields_list[wmvc_show_data('idfield', $field)] = '#' . wmvc_show_data('idfield', $field) . ' ' . wmvc_show_data('field_label', $field) . '[' . wmvc_show_data('field_type', $field) . ']';
425
426 if (wmvc_show_data('field_type', $field) == 'FILEUPLOAD') {
427 $this->fields_list_files[] = wmvc_show_data('idfield', $field);
428 }
429 }
430
431 if (wmvc_show_data('field_type', $field) == 'NUMBER') {
432 $fields_number_types[] = wmvc_show_data('idfield', $field);
433 }
434 }
435
436 // build raw_options preserving order
437 $raw = [];
438 foreach ( $fields_list as $k => $v ) {
439 $raw[] = [
440 'value' => (string) $k,
441 'label' => $v,
442 ];
443 }
444
445 $this->add_control(
446 'field_id',
447 [
448 'label' => __('Field id', 'wpdirectorykit'),
449 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
450 'default' => '',
451 'options' => $fields_list,
452 'raw_options' => $raw,
453 'separator' => 'after',
454 ]
455 );
456
457 $this->add_control(
458 'hide_onempty',
459 [
460 'label' => __('Hide if empty', 'wpdirectorykit'),
461 'type' => \Elementor\Controls_Manager::SWITCHER,
462 'label_on' => __('True', 'wpdirectorykit'),
463 'label_off' => __('False', 'wpdirectorykit'),
464 'return_value' => 'yes',
465 'default' => '',
466 ]
467 );
468
469 $this->add_control(
470 'link_value',
471 [
472 'label' => esc_html__('in case of link detected', 'wpdirectorykit'),
473 'type' => Controls_Manager::SELECT,
474 'options' => [
475 '' => esc_html__('Default', 'wpdirectorykit'),
476 'value' => esc_html__('show value', 'wpdirectorykit'),
477 'label' => esc_html__('show field label', 'wpdirectorykit'),
478 'icon' => esc_html__('show field icon', 'wpdirectorykit'),
479 ],
480 ]
481 );
482
483 $this->add_control(
484 'show_like_stars',
485 [
486 'label' => __('Show like stars', 'wpdirectorykit'),
487 'type' => \Elementor\Controls_Manager::SWITCHER,
488 'label_on' => __('On', 'wpdirectorykit'),
489 'label_off' => __('Off', 'wpdirectorykit'),
490 'return_value' => 'yes',
491 'default' => '',
492 'description' => esc_html__('Numeric values required', 'wpdirectorykit'),
493 'condition' => [
494 'field_id' => $fields_number_types,
495 ],
496 ]
497 );
498
499 $this->add_control(
500 'max_stars',
501 [
502 'label' => __('Max Stars', 'wpdirectorykit'),
503 'type' => \Elementor\Controls_Manager::NUMBER,
504 'min' => 1,
505 'max' => 10,
506 'step' => 1,
507 'default' => 5,
508 'condition' => [
509 'show_like_stars' => 'yes',
510 ],
511 'description' => esc_html__('Set the maximum number of stars to display.', 'wpdirectorykit'),
512 ]
513 );
514
515 $this->end_controls_section();
516 }
517
518 private function generate_controls_layout() {}
519
520
521 private function generate_controls_styles()
522 {
523 $items = [
524 [
525 'key' => 'field_value',
526 'label' => esc_html__('Field Value', 'wpdirectorykit'),
527 'selector' => '{{WRAPPER}} .wdk-field-value .value, {{WRAPPER}} .wdk-field-value .value p',
528 'selector_hover' => '{{WRAPPER}} .wdk-field-value .value%1$s, {{WRAPPER}} .wdk-field-value .value%1$s p, .wdk-listings-results .hover_link:hover {{WRAPPER}} .wdk-field-value .value, .wdk-listings-results .hover_link:hover {{WRAPPER}} .wdk-field-value .value p',
529 'options' => 'full',
530 ],
531 [
532 'key' => 'field_prefix',
533 'label' => esc_html__('Field Prefix', 'wpdirectorykit'),
534 'selector' => '{{WRAPPER}} .wdk-field-value .prefix',
535 'selector_hover' => '{{WRAPPER}} .wdk-field-value .prefix%1$s, .wdk-listings-results .hover_link:hover {{WRAPPER}} .wdk-field-value .prefix',
536 'options' => 'full',
537 ],
538 [
539 'key' => 'field_suffix',
540 'label' => esc_html__('Field Suffix', 'wpdirectorykit'),
541 'selector' => '{{WRAPPER}} .wdk-field-value .suffix',
542 'selector_hover' => '{{WRAPPER}} .wdk-field-value .suffix%1$s, .wdk-listings-results .hover_link:hover {{WRAPPER}} .wdk-field-value .suffix',
543 'options' => 'full',
544 ]
545 ];
546
547 foreach ($items as $item) {
548 $this->start_controls_section(
549 $item['key'] . '_section',
550 [
551 'label' => $item['label'],
552 'tab' => 'tab_layout',
553 'conditions' => [
554 'terms' => [
555 [
556 'name' => 'field_id',
557 'operator' => '!in',
558 'value' => $this->fields_list_files,
559 ],
560 [
561 'name' => 'show_like_stars',
562 'operator' => '!=',
563 'value' => 'yes',
564 ],
565 ],
566 ],
567 ]
568 );
569
570 if ($item['key'] == 'field_value') {
571 $selectors = array(
572 'normal' => '{{WRAPPER}} .wdk-field-value',
573 );
574 $this->generate_renders_tabs($selectors, $item['key'] . '_dynamic_align', ['align']);
575 }
576
577 $selectors = array();
578 if (!empty($item['selector']))
579 $selectors['normal'] = $item['selector'];
580
581 if (!empty($item['selector_hover']))
582 $selectors['hover'] = $item['selector_hover'];
583
584 if (!empty($item['selector_focus']))
585 $selectors['focus'] = $item['selector_hover'];
586
587 $this->generate_renders_tabs($selectors, $item['key'] . '_dynamic', $item['options'], ['align']);
588
589 $this->end_controls_section();
590 /* END special for some elements */
591 }
592
593
594 $this->start_controls_section(
595 'field_checkbox_icon',
596 [
597 'label' => esc_html__('Checkbox', 'wpdirectorykit'),
598 'tab' => Controls_Manager::TAB_STYLE,
599 'conditions' => [
600 'terms' => [
601 [
602 'name' => 'field_id',
603 'operator' => '!in',
604 'value' => $this->fields_list_files,
605 ],
606 [
607 'name' => 'show_like_stars',
608 'operator' => '!=',
609 'value' => 'yes',
610 ],
611 ],
612 ],
613 ]
614 );
615
616 $this->add_responsive_control(
617 'field_checkbox_icon_success_header',
618 [
619 'label' => esc_html__('Success checkbox', 'wpdirectorykit'),
620 'type' => Controls_Manager::HEADING,
621 'separator' => 'before',
622 ]
623 );
624
625 $this->add_control(
626 'field_checkbox_icon_success',
627 [
628 'label' => esc_html__('Icon', 'wpdirectorykit'),
629 'type' => Controls_Manager::ICONS,
630 'label_block' => true,
631 'default' => [
632 'value' => 'fa fa-check',
633 'library' => 'solid',
634 ],
635 ]
636 );
637
638 $selectors = array(
639 'normal' => '{{WRAPPER}} .field_checkbox_success',
640 );
641 $this->generate_renders_tabs($selectors, 'field_checkbox_icon_success_dynamic', 'full');
642
643
644 $this->add_responsive_control(
645 'field_checkbox_icon_unsuccess_header',
646 [
647 'label' => esc_html__('Unsuccess checkbox', 'wpdirectorykit'),
648 'type' => Controls_Manager::HEADING,
649 'separator' => 'before',
650 ]
651 );
652
653 $this->add_control(
654 'field_checkbox_icon_unsuccess',
655 [
656 'label' => esc_html__('Icon', 'wpdirectorykit'),
657 'type' => Controls_Manager::ICONS,
658 'label_block' => true,
659 'default' => [
660 'value' => 'fa fa-close',
661 'library' => 'solid',
662 ],
663 ]
664 );
665
666 $selectors = array(
667 'normal' => '{{WRAPPER}} .field_checkbox_unsuccess',
668 );
669 $this->generate_renders_tabs($selectors, 'field_checkbox_icon_unsuccess_dynamic', 'full');
670
671 $this->end_controls_section();
672
673
674
675 /* Stars */
676 $this->start_controls_section(
677 'field_star_icon',
678 [
679 'label' => esc_html__('Stars Options', 'wpdirectorykit'),
680 'tab' => Controls_Manager::TAB_STYLE,
681 'conditions' => [
682 'terms' => [
683 [
684 'name' => 'show_like_stars',
685 'value' => 'yes',
686 ],
687 ],
688 ],
689 ]
690 );
691
692 $this->add_responsive_control(
693 'active_star_icon_header',
694 [
695 'label' => esc_html__('Active Star Icon', 'wpdirectorykit'),
696 'type' => Controls_Manager::HEADING,
697 'separator' => 'before',
698 ]
699 );
700
701 $this->add_control(
702 'active_star_icon',
703 [
704 'label' => esc_html__('Icon', 'wpdirectorykit'),
705 'type' => Controls_Manager::ICONS,
706 'label_block' => true,
707 'default' => [
708 'value' => 'fas fa-star',
709 'library' => 'solid',
710 ],
711 ]
712 );
713
714 $selectors = array(
715 'normal' => '{{WRAPPER}} .wdk-field-value-stars-lst .star-active',
716 );
717 $this->generate_renders_tabs($selectors, 'active_star_icon_dynamic', ['color']);
718
719 $this->add_responsive_control(
720 'inactive_star_icon_header',
721 [
722 'label' => esc_html__('Inactive Star Icon', 'wpdirectorykit'),
723 'type' => Controls_Manager::HEADING,
724 'separator' => 'before',
725 ]
726 );
727
728 $this->add_control(
729 'inactive_star_icon',
730 [
731 'label' => esc_html__('Icon', 'wpdirectorykit'),
732 'type' => Controls_Manager::ICONS,
733 'label_block' => true,
734 'default' => [
735 'value' => 'far fa-star',
736 'library' => 'solid',
737 ],
738 ]
739 );
740
741 $selectors = array(
742 'normal' => '{{WRAPPER}} .wdk-field-value-stars-lst .innactive',
743 );
744 $this->generate_renders_tabs($selectors, 'inactive_star_icon_dynamic', ['color']);
745
746 $this->add_responsive_control(
747 'star_icon_header',
748 [
749 'label' => esc_html__('Global Options', 'wpdirectorykit'),
750 'type' => Controls_Manager::HEADING,
751 'separator' => 'before',
752 ]
753 );
754
755 $this->add_responsive_control(
756 'star_icon_size',
757 [
758 'label' => esc_html__('Star Icon Size', 'wpdirectorykit'),
759 'type' => \Elementor\Controls_Manager::SLIDER,
760 'size_units' => [ 'px', 'em', 'rem' ],
761 'range' => [
762 'px' => [
763 'min' => 8,
764 'max' => 64,
765 ],
766 'em' => [
767 'min' => 0.5,
768 'max' => 4,
769 ],
770 'rem' => [
771 'min' => 0.5,
772 'max' => 4,
773 ],
774 ],
775 'selectors' => [
776 '{{WRAPPER}} .wdk-field-value-stars-lst i, {{WRAPPER}} .wdk-field-value-stars-lst svg' => 'font-size: {{SIZE}}{{UNIT}};',
777 '{{WRAPPER}} .wdk-field-value-stars-lst img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
778 ],
779 ]
780 );
781
782
783 // Add gap between stars
784 $this->add_responsive_control(
785 'stars_gap',
786 [
787 'label' => esc_html__('Stars Gap', 'wpdirectorykit'),
788 'type' => \Elementor\Controls_Manager::SLIDER,
789 'size_units' => [ 'px', 'em', '%' ],
790 'range' => [
791 'px' => [
792 'min' => 0,
793 'max' => 50,
794 ],
795 'em' => [
796 'min' => 0,
797 'max' => 5,
798 ],
799 '%' => [
800 'min' => 0,
801 'max' => 20,
802 ],
803 ],
804 'selectors' => [
805 '{{WRAPPER}} .wdk-field-value-stars-lst' => 'gap: {{SIZE}}{{UNIT}};',
806 ],
807 ]
808 );
809
810 // Add alignment control for stars using flexbox
811 $this->add_responsive_control(
812 'stars_alignment',
813 [
814 'label' => esc_html__('Stars Alignment', 'wpdirectorykit'),
815 'type' => \Elementor\Controls_Manager::CHOOSE,
816 'options' => [
817 'flex-start' => [
818 'title' => esc_html__('Left', 'wpdirectorykit'),
819 'icon' => 'eicon-text-align-left',
820 ],
821 'center' => [
822 'title' => esc_html__('Center', 'wpdirectorykit'),
823 'icon' => 'eicon-text-align-center',
824 ],
825 'flex-end' => [
826 'title' => esc_html__('Right', 'wpdirectorykit'),
827 'icon' => 'eicon-text-align-right',
828 ],
829 ],
830 'default' => 'flex-start',
831 'selectors' => [
832 '{{WRAPPER}} .wdk-field-value-stars-lst' => 'justify-content: {{VALUE}};',
833 ],
834 ]
835 );
836
837 $this->end_controls_section();
838 }
839
840
841 private function generate_controls_styles_files()
842 {
843 $this->start_controls_section(
844 'files_styles_thmbn_section',
845 [
846 'label' => esc_html__('Main', 'wpdirectorykit'),
847 'tab' => Controls_Manager::TAB_STYLE,
848 'conditions' => [
849 'terms' => [
850 [
851 'name' => 'field_id',
852 'operator' => 'in',
853 'value' => $this->fields_list_files,
854 ]
855 ],
856 ],
857 ]
858 );
859
860 $this->add_responsive_control(
861 'files_row_gap_col',
862 [
863 'label' => __('Columns', 'wpdirectorykit'),
864 'type' => Controls_Manager::SELECT,
865 'options' => [
866 '' => esc_html__('Default', 'wpdirectorykit'),
867 'auto' => esc_html__('Auto', 'wpdirectorykit'),
868 '100%' => '1',
869 '50%' => '2',
870 'calc(100% / 3)' => '3',
871 '25%' => '4',
872 '20%' => '5',
873 'auto_flexible' => 'auto flexible',
874 ],
875 'selectors_dictionary' => [
876 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
877 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
878 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
879 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
880 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
881 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
882 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
883 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
884 ],
885 'selectors' => [
886 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
887 ],
888 'default' => 'calc(100% / 3)',
889 'separator' => 'before',
890 ]
891 );
892
893 $this->add_responsive_control(
894 'files_column_gap',
895 [
896 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
897 'type' => Controls_Manager::SLIDER,
898 'default' => [
899 'size' => 10,
900 ],
901 'range' => [
902 'px' => [
903 'min' => 0,
904 'max' => 60,
905 ],
906 ],
907 'selectors' => [
908 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
909 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
910 ],
911 ]
912 );
913
914 $this->add_responsive_control(
915 'files_row_gap',
916 [
917 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
918 'type' => Controls_Manager::SLIDER,
919 'range' => [
920 'px' => [
921 'min' => 0,
922 'max' => 60,
923 ],
924 ],
925 'selectors' => [
926 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
927 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
928 ],
929 ]
930 );
931
932 $this->end_controls_section();
933
934 $this->start_controls_section(
935 'files_styles_thmbn_type',
936 [
937 'label' => esc_html__('Thumbnail', 'wpdirectorykit'),
938 'tab' => Controls_Manager::TAB_STYLE,
939 'conditions' => [
940 'terms' => [
941 [
942 'name' => 'field_id',
943 'operator' => 'in',
944 'value' => $this->fields_list_files,
945 ]
946 ],
947 ],
948 ]
949 );
950
951 $this->add_control(
952 'files_layout_image_design',
953 [
954 'label' => __('Size style thumbnail', 'wpdirectorykit'),
955 'type' => \Elementor\Controls_Manager::SELECT,
956 'options' => [
957 '' => __('None', 'wpdirectorykit'),
958 'contain' => __('Contain', 'wpdirectorykit'),
959 'cover' => __('Cover', 'wpdirectorykit'),
960 ],
961 'selectors' => [
962 '{{WRAPPER}} .wdk-field-files .wdk-listing-image' => 'object-fit: {{VALUE}}',
963 ],
964 ]
965 );
966
967 $selectors = array(
968 'normal' => '{{WRAPPER}} .wdk-field-files .wdk-listing-image',
969 );
970 $this->generate_renders_tabs($selectors, 'files_layout_image_dynamic', ['margin', 'padding', 'background', 'border', 'border_radius', 'css_filters', 'shadow', 'transition']);
971
972 $this->add_control(
973 'files_enable_fixed_height',
974 [
975 'label' => __('Fixed Height', 'wpdirectorykit'),
976 'type' => \Elementor\Controls_Manager::SWITCHER,
977 'label_on' => __('True', 'wpdirectorykit'),
978 'label_off' => __('False', 'wpdirectorykit'),
979 'return_value' => 'yes',
980 'default' => 'yes',
981 ]
982 );
983
984 $this->add_responsive_control(
985 'files_styles_thmbn_des_height',
986 [
987 'label' => esc_html__('Height', 'wpdirectorykit'),
988 'type' => Controls_Manager::SLIDER,
989 'range' => [
990 'px' => [
991 'min' => 100,
992 'max' => 1500,
993 ],
994 'vw' => [
995 'min' => 0,
996 'max' => 100,
997 ],
998 ],
999 'size_units' => ['px', 'em', 'vw', '%', 'custom'],
1000 'selectors' => [
1001 '{{WRAPPER}} .wdk-field-files .wdk-listing-image' => 'height: {{SIZE}}{{UNIT}}',
1002 ],
1003 'separator' => 'after',
1004 'conditions' => [
1005 'terms' => [
1006 [
1007 'name' => 'files_enable_fixed_height',
1008 'operator' => '==',
1009 'value' => 'yes',
1010 ]
1011 ],
1012 ],
1013 ]
1014 );
1015
1016 $this->end_controls_section();
1017
1018 $items = [
1019 [
1020 'key' => 'image',
1021 'label' => esc_html__('Image', 'wpdirectorykit'),
1022 'selector' => '{{WRAPPER}} .wdk-field-files .wdk-listing-image-card .wdk-listing-image',
1023 'selector_hover' => '{{WRAPPER}} .wdk-field-files .wdk-listing-image-card%1$s .wdk-listing-image',
1024 'options' => ['margin', 'background', 'border', 'border_radius', 'padding', 'shadow', 'transition', 'css_filters'],
1025 ],
1026 ];
1027
1028 foreach ($items as $item) {
1029 $this->start_controls_section(
1030 'files_' . $item['key'] . '_section',
1031 [
1032 'label' => $item['label'],
1033 'tab' => Controls_Manager::TAB_STYLE,
1034 'conditions' => [
1035 'terms' => [
1036 [
1037 'name' => 'field_id',
1038 'operator' => 'in',
1039 'value' => $this->fields_list_files,
1040 ]
1041 ],
1042 ],
1043 ]
1044 );
1045
1046 if ($item['key'] == 'caption')
1047 $this->add_responsive_control(
1048 'files_' . $item['key'] . '_hide',
1049 [
1050 'label' => esc_html__('Hide Element', 'wpdirectorykit'),
1051 'type' => Controls_Manager::SWITCHER,
1052 'none' => esc_html__('Hide', 'wpdirectorykit'),
1053 'block' => esc_html__('Show', 'wpdirectorykit'),
1054 'return_value' => 'none',
1055 'default' => '',
1056 'selectors' => [
1057 $item['selector'] => 'display: {{VALUE}};',
1058 ],
1059 ]
1060 );
1061
1062 $selectors = array(
1063 'normal' => $item['selector'],
1064 'hover' => $item['selector_hover'],
1065 );
1066 $this->generate_renders_tabs($selectors, $item['key'] . '_dynamic', $item['options']);
1067
1068 $this->end_controls_section();
1069 }
1070
1071
1072 /* files */
1073 if (true) {
1074
1075 $this->start_controls_section(
1076 'files_files_section',
1077 [
1078 'label' => esc_html__('Files List', 'wpdirectorykit'),
1079 'tab' => Controls_Manager::TAB_STYLE,
1080 'conditions' => [
1081 'terms' => [
1082 [
1083 'name' => 'field_id',
1084 'operator' => 'in',
1085 'value' => $this->fields_list_files,
1086 ]
1087 ],
1088 ],
1089 ]
1090 );
1091
1092 $this->add_responsive_control(
1093 'files_files_section_hide',
1094 [
1095 'label' => esc_html__('Hide Element', 'wpdirectorykit'),
1096 'type' => Controls_Manager::SWITCHER,
1097 'none' => esc_html__('Hide', 'wpdirectorykit'),
1098 'block' => esc_html__('Show', 'wpdirectorykit'),
1099 'return_value' => 'yes',
1100 'default' => '',
1101 ]
1102 );
1103
1104 $this->add_control(
1105 'files_files_section_box_header',
1106 [
1107 'label' => __('Container', 'wpdirectorykit'),
1108 'type' => \Elementor\Controls_Manager::HEADING,
1109 ]
1110 );
1111
1112 $selectors = array(
1113 'normal' => '{{WRAPPER}} .wdk-field-files .files-row ul.files',
1114 );
1115
1116 $this->generate_renders_tabs($selectors, 'files_section_bo_dynamic', ['background', 'border', 'border_radius', 'padding', 'margin', 'shadow', 'transition']);
1117
1118 $this->add_control(
1119 'files_section_li',
1120 [
1121 'label' => __('List Items', 'wpdirectorykit'),
1122 'type' => \Elementor\Controls_Manager::HEADING,
1123 ]
1124 );
1125
1126 $this->add_control(
1127 'files_section_li_hr',
1128 [
1129 'type' => \Elementor\Controls_Manager::DIVIDER,
1130 ]
1131 );
1132
1133 $this->add_control(
1134 'files_section_space',
1135 [
1136 'label' => __('Vertical Space', 'wpdirectorykit'),
1137 'type' => Controls_Manager::SLIDER,
1138 'size_units' => ['px'],
1139 'range' => [
1140 'px' => [
1141 'min' => 0,
1142 'max' => 250,
1143 'step' => 1,
1144 ],
1145 ],
1146 'selectors' => [
1147 '{{WRAPPER}} .wdk-field-files .files-row ul.files li:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1148 ],
1149 ]
1150 );
1151
1152 $selectors = array(
1153 'normal' => '{{WRAPPER}} .wdk-field-files .files-row ul.files li',
1154 );
1155
1156 $this->generate_renders_tabs($selectors, 'files_section_item_dynamic', ['align', 'background', 'border', 'border_radius', 'padding', 'shadow', 'transition']);
1157
1158 $this->add_control(
1159 'files_section_hr',
1160 [
1161 'type' => \Elementor\Controls_Manager::DIVIDER,
1162 ]
1163 );
1164
1165 $this->add_control(
1166 'files_section_items',
1167 [
1168 'label' => __('More Styles', 'wpdirectorykit'),
1169 'type' => \Elementor\Controls_Manager::HEADING,
1170 ]
1171 );
1172
1173 $items = [
1174 [
1175 'key' => 'files_icon',
1176 'label' => esc_html__('Icon', 'wpdirectorykit'),
1177 'selector' => '{{WRAPPER}} .wdk-field-files .files-row .list-item a .wdk-listing-file-icon',
1178 'selector_hover' => '{{WRAPPER}} .wdk-field-files .files-row .list-item%1$s a .wdk-listing-file-icon',
1179 'options' => ['margin', 'background', 'border', 'border_radius', 'padding', 'shadow', 'transition', 'image_size_control', 'css_filters', 'hover_animation'],
1180 ],
1181 [
1182 'key' => 'files_caption',
1183 'label' => esc_html__('Caption', 'wpdirectorykit'),
1184 'selector' => '{{WRAPPER}} .wdk-field-files .files-row .list-item a',
1185 'selector_hover' => '{{WRAPPER}} .wdk-field-files .files-row .list-item a%1$s',
1186 'options' => ['margin', 'align', 'typo', 'color', 'background', 'border', 'border_radius', 'padding', 'shadow', 'transition'],
1187 ],
1188 ];
1189
1190 foreach ($items as $item) {
1191 $this->add_control(
1192 $item['key'] . '_header',
1193 [
1194 'label' => $item['label'],
1195 'type' => \Elementor\Controls_Manager::HEADING,
1196 ]
1197 );
1198
1199 if ($item['key'] == 'files_icon')
1200 $this->add_responsive_control(
1201 $item['key'] . '_hide',
1202 [
1203 'label' => esc_html__('Hide Element', 'wpdirectorykit'),
1204 'type' => Controls_Manager::SWITCHER,
1205 'none' => esc_html__('Hide', 'wpdirectorykit'),
1206 'block' => esc_html__('Show', 'wpdirectorykit'),
1207 'return_value' => 'none',
1208 'default' => '',
1209 'selectors' => [
1210 $item['selector'] => 'display: {{VALUE}};',
1211 ],
1212 ]
1213 );
1214
1215 $selectors = array(
1216 'normal' => $item['selector'],
1217 'hover' => $item['selector_hover'],
1218 );
1219 $this->generate_renders_tabs($selectors, $item['key'] . '_dynamic', $item['options']);
1220 }
1221
1222 $this->end_controls_section();
1223 }
1224 }
1225
1226 private function generate_controls_content() {}
1227
1228 public function enqueue_styles_scripts() {}
1229 }
1230