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
← All changes | elementor-elements/classes/wdk-listing-slider.php +139 -6 1.2.8 → 1.5.9 View file →
@@ -138,9 +138,12 @@
138 138
139 139 $this->data['id_element'] = $this->get_id();
140 140 $this->data['settings'] = $this->get_settings();
141 141
142 + $this->data['plans_exists'] = false;
142 143 $this->data['images'] = array();
144 + $this->data['images_fields'] = array();
145 +
143 146 if(!Plugin::$instance->editor->is_edit_mode()) {
144 147 $this->data['images'] = wdk_listing_images_data (array('listing_images'=>wdk_field_value ('listing_images', $wdk_listing_id)), 'full');
145 148 $this->data['images'] = array_slice($this->data['images'], ($this->data['settings']['offset_images']-1), $this->data['settings']['limit_images']);
146 149 } else {
@@ -146,8 +149,49 @@
146 149 } else {
147 150 $this->data['images'] = array_fill(0, $this->data['settings']['limit_images'], wdk_placeholder_image_src());
148 151 }
149 152
153 + if(!Plugin::$instance->editor->is_edit_mode() && !empty($this->data['settings']['plans_enable'])) {
154 + $plan_images = wdk_listing_images_data(wdk_field_value('listing_plans_documents', $wdk_listing_id), 'full');
155 + if (!empty($plan_images) && is_array($plan_images)) {
156 + foreach ($plan_images as $k => $v) {
157 + $this->data['images']['plans__'.$k] = $v;
158 + }
159 + $this->data['plans_exists'] = true;
160 + }
161 + }
162 +
163 + if(!empty($this->data['settings']['gallery_fields'])) {
164 + foreach ($this->data['settings']['gallery_fields'] as $key => $field_id) {
165 + if(strpos( $field_id,'__') !== FALSE){
166 + $field_id = substr( $field_id, strpos($field_id, '__')+2);
167 + }
168 +
169 +
170 + $field_value = wdk_field_value($field_id, $wdk_listing_id);
171 + $images = wdk_files_data($field_value, 'full');
172 + if (!empty($images) && is_array($images)) {
173 + $this->data['images_fields'][$field_id] = $images;
174 + foreach ($images as $k => $v) {
175 + $this->data['images'][$field_id.'__'.$k] = $v;
176 + }
177 + }
178 + }
179 + }
180 +
181 + if(!empty($this->data['settings']['embed_fields'])) {
182 + foreach ($this->data['settings']['embed_fields'] as $key => $field_id) {
183 + if(strpos( $field_id,'__') !== FALSE){
184 + $field_id = substr( $field_id, strpos($field_id, '__')+2);
185 + }
186 + $images = wdk_field_value($field_id, $wdk_listing_id);
187 + if(!empty($images)) {
188 + $this->data['images_fields'][$field_id] = $images;
189 + }
190 + $this->data['images'][$field_id.'__'.$key] = $images;
191 + }
192 + }
193 +
150 194 $this->data['is_edit_mode']= false;
151 195 if(Plugin::$instance->editor->is_edit_mode()) {
152 196 $this->data['is_edit_mode']= true;
153 197 } else {
@@ -153,9 +197,9 @@
153 197 } else {
154 198 /* return false if no content */
155 199 }
156 200
157 - echo $this->view('wdk-listing-slider', $this->data);
201 + $this->view('wdk-listing-slider', $this->data, true);
158 202 }
159 203
160 204
161 205 private function generate_controls_conf() {
@@ -170,12 +214,12 @@
170 214
171 215 $this->add_control(
172 216 'popup_enable',
173 217 [
174 - 'label' => __( 'Open Images / Video in popup', 'wdk-listing-sliders' ),
218 + 'label' => __( 'Open Images / Video in popup', 'wpdirectorykit' ),
175 219 'type' => \Elementor\Controls_Manager::SWITCHER,
176 - 'label_on' => __( 'On', 'wdk-listing-sliders' ),
177 - 'label_off' => __( 'Off', 'wdk-listing-sliders' ),
220 + 'label_on' => __( 'On', 'wpdirectorykit' ),
221 + 'label_off' => __( 'Off', 'wpdirectorykit' ),
178 222 'return_value' => 'yes',
179 223 'default' => '',
180 224 ]
181 225 );
@@ -180,8 +224,97 @@
180 224 ]
181 225 );
182 226
183 227 $this->add_control(
228 + 'plans_enable',
229 + [
230 + 'label' => __( 'Plans Enable', 'wpdirectorykit' ),
231 + 'type' => \Elementor\Controls_Manager::SWITCHER,
232 + 'label_on' => __( 'On', 'wpdirectorykit' ),
233 + 'label_off' => __( 'Off', 'wpdirectorykit' ),
234 + 'return_value' => 'yes',
235 + 'default' => '',
236 + ]
237 + );
238 +
239 +
240 +
241 + $fields_data = wdk_cached_field_get();
242 + $fields_list_files = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
243 + $fields_list_embed = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
244 + $order_i = 0;
245 + foreach($fields_data as $field)
246 + {
247 + if(wmvc_show_data('field_type', $field) == 'FILEUPLOAD') {
248 + $fields_list_files[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
249 + }
250 + if(wmvc_show_data('field_type', $field) == 'INPUTBOX') {
251 + $fields_list_embed[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
252 + }
253 + }
254 +
255 +
256 + $this->add_control(
257 + 'gallery_fields',
258 + [
259 + 'label' => __( 'Add Custom Gallery Fields', 'wpdirectorykit' ),
260 + 'type' => \Elementor\Controls_Manager::SELECT2,
261 + 'options' => $fields_list_files,
262 + 'multiple' => true,
263 + 'default' => [],
264 + 'label_block' => true,
265 + 'description' => __( 'Select one or more fields to use as gallery sources.', 'wpdirectorykit' ),
266 + ]
267 + );
268 +
269 + $this->add_control(
270 + 'auto_start_video',
271 + [
272 + 'label' => __( 'Auto Start Video', 'wpdirectorykit' ),
273 + 'type' => \Elementor\Controls_Manager::SWITCHER,
274 + 'label_on' => __( 'On', 'wpdirectorykit' ),
275 + 'label_off' => __( 'Off', 'wpdirectorykit' ),
276 + 'return_value' => 'yes',
277 + 'default' => '',
278 + 'description' => __( 'Enable this option to automatically start videos when the slide becomes active.', 'wpdirectorykit' ),
279 + ]
280 + );
281 +
282 +
283 + $this->add_control(
284 + 'embed_fields',
285 + [
286 + 'label' => __( 'Add Embed Fields', 'wpdirectorykit' ),
287 + 'type' => \Elementor\Controls_Manager::SELECT2,
288 + 'options' => $fields_list_embed,
289 + 'multiple' => true,
290 + 'default' => [],
291 + 'label_block' => true,
292 +
293 + 'description' => __( 'Select one or more fields to use as embed sources.', 'wpdirectorykit' ),
294 + ]
295 + );
296 +
297 + $this->add_responsive_control(
298 + 'tabs_direction',
299 + [
300 + 'label' => __( 'Direction Tabs', 'wpdirectorykit' ),
301 + 'type' => Controls_Manager::SELECT,
302 + 'options' => [
303 + '' => esc_html__('Default', 'wpdirectorykit'),
304 + 'row' => esc_html__('Row', 'wpdirectorykit'),
305 + 'row-reverse' => esc_html__('Row reverse', 'wpdirectorykit'),
306 + 'column' => esc_html__('Column', 'wpdirectorykit'),
307 + 'column-reverse' => esc_html__('Column reverse', 'wpdirectorykit'),
308 + ],
309 + 'selectors' => [
310 + '{{WRAPPER}} .wdk-listing-slider .wdk-listing-slider--tabs' => 'flex-direction: {{UNIT}}',
311 + ],
312 + 'separator' => 'after',
313 + ]
314 + );
315 +
316 + $this->add_control(
184 317 'limit_images',
185 318 [
186 319 'label' => __( 'Limit Images', 'wpdirectorykit' ),
187 320 'type' => \Elementor\Controls_Manager::NUMBER,
@@ -401,9 +534,9 @@
401 534 'min' => 0,
402 535 'max' => 100,
403 536 ],
404 537 ],
405 - 'size_units' => [ 'px', 'vw' ],
538 + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ],
406 539 'default' => [
407 540 'size' => 350,
408 541 'unit' => 'px',
409 542 ],
@@ -493,9 +626,9 @@
493 626 'min' => 0,
494 627 'max' => 100,
495 628 ],
496 629 ],
497 - 'size_units' => [ 'px', 'vw' ],
630 + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ],
498 631 'default' => [
499 632 'size' => 80,
500 633 'unit' => 'px',
501 634 ],