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-field-icon.php +35 -65 1.2.5 → 1.5.9 View file →
@@ -153,22 +153,37 @@
153 153 if(!empty($this->data['settings']['field_id'])) {
154 154 if(strpos($this->data['settings']['field_id'],'__') !== FALSE){
155 155 $this->data['settings']['field_id'] = substr($this->data['settings']['field_id'], strpos($this->data['settings']['field_id'],'__')+2);
156 156 }
157 - if(wdk_field_option ($this->data['settings']['field_id'], 'icon_id'))
157 + if($this->data['settings']['field_id'] == 'category_id') {
158 + $this->WMVC->model('category_m');
159 + $tree_data = $this->WMVC->category_m->get(wdk_field_value ($this->data['settings']['field_id'], $wdk_listing_id), TRUE);
160 + $this->data['field_icon'] = wmvc_show_data('icon_id', $tree_data);
161 + } else if($this->data['settings']['field_id'] == 'location_id') {
162 + $this->WMVC->model('location_id');
163 + $tree_data = $this->WMVC->location_id->get(wdk_field_value ($this->data['settings']['field_id'], $wdk_listing_id), TRUE);
164 + $this->data['field_icon'] = wmvc_show_data('icon_id', $tree_data);
165 + } else {
158 166 $this->data['field_icon'] = wdk_field_option ($this->data['settings']['field_id'], 'icon_id');
167 + }
159 168 }
160 169
170 +
161 171 $this->data['is_edit_mode']= false;
162 172 if(Plugin::$instance->editor->is_edit_mode()){
163 173 $this->data['is_edit_mode']= true;
164 174 } else {
175 +
165 176 /* return false if no content */
166 - if(wdk_field_option ($this->data['settings']['field_id'], 'icon_id') == '')
177 + if($this->data['settings']['hide_onempty'] == 'yes' && $this->data['field_icon'] == '')
167 178 return false;
179 +
180 + /* return false if no content */
181 + if($this->data['field_icon'] == '')
182 + return false;
168 183 }
169 184
170 - echo $this->view('wdk-field-icon', $this->data);
185 + $this->view('wdk-field-icon', $this->data, true);
171 186 }
172 187
173 188
174 189 private function generate_controls_conf() {
@@ -179,11 +194,9 @@
179 194 'tab' => '1',
180 195 ]
181 196 );
182 197
183 - $WMVC = &wdk_get_instance();
184 - $WMVC->model('field_m');
185 - $fields_data = $WMVC->field_m->get();
198 + $fields_data = wdk_cached_field_get();
186 199 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
187 200 $order_i = 0;
188 201
189 202 $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
@@ -204,9 +217,9 @@
204 217 $this->add_control(
205 218 'field_id',
206 219 [
207 220 'label' => __( 'Field id', 'wpdirectorykit' ),
208 - 'type' => \Elementor\Controls_Manager::SELECT,
221 + 'type' => \Elementor\Controls_Manager::SELECT2,
209 222 'default' => '',
210 223 'options' => $fields_list,
211 224 'separator' => 'after',
212 225 ]
@@ -211,8 +224,20 @@
211 224 'separator' => 'after',
212 225 ]
213 226 );
214 227
228 + $this->add_control(
229 + 'hide_onempty',
230 + [
231 + 'label' => __( 'Hide if empty', 'wpdirectorykit' ),
232 + 'type' => \Elementor\Controls_Manager::SWITCHER,
233 + 'label_on' => __( 'True', 'wpdirectorykit' ),
234 + 'label_off' => __( 'False', 'wpdirectorykit' ),
235 + 'return_value' => 'yes',
236 + 'default' => '',
237 + ]
238 + );
239 +
215 240 $this->end_controls_section();
216 241
217 242 }
218 243
@@ -228,68 +253,13 @@
228 253 'tab' => Controls_Manager::TAB_STYLE,
229 254 ]
230 255 );
231 256
232 - $this->add_responsive_control (
233 - 'field_group_icon_max_heigth',
234 - [
235 - 'label' => esc_html__('Max Height', 'wpdirectorykit'),
236 - 'type' => Controls_Manager::SLIDER,
237 - 'range' => [
238 - 'px' => [
239 - 'min' => 10,
240 - 'max' => 1500,
241 - ],
242 - 'vw' => [
243 - 'min' => 0,
244 - 'max' => 100,
245 - ],
246 - '%' => [
247 - 'min' => 0,
248 - 'max' => 100,
249 - ],
250 - ],
251 - 'size_units' => [ 'px', 'vw','%' ],
252 - 'default' => [
253 - 'unit' => 'px',
254 - 'size' => 18,
255 - ],
256 - 'selectors' => [
257 - '{{WRAPPER}} .wdk-field-icon' => 'max-width: {{SIZE}}{{UNIT}}',
258 - ],
259 - ]
257 + $selectors = array(
258 + 'normal' => '{{WRAPPER}} .wdk-field-icon img',
260 259 );
260 + $this->generate_renders_tabs($selectors, 'layout_image_dynamic', ['image_size_control','image_fit_control', 'height', 'width','css_filters']);
261 261
262 -
263 - $this->add_responsive_control (
264 - 'field_group_icon_max_width',
265 - [
266 - 'label' => esc_html__('Max Width', 'wpdirectorykit'),
267 - 'type' => Controls_Manager::SLIDER,
268 - 'range' => [
269 - 'px' => [
270 - 'min' => 10,
271 - 'max' => 1500,
272 - ],
273 - 'vw' => [
274 - 'min' => 0,
275 - 'max' => 100,
276 - ],
277 - '%' => [
278 - 'min' => 0,
279 - 'max' => 100,
280 - ],
281 - ],
282 - 'size_units' => [ 'px', 'vw','%' ],
283 - 'default' => [
284 - 'unit' => 'px',
285 - 'size' => 18,
286 - ],
287 - 'selectors' => [
288 - '{{WRAPPER}} .wdk-field-icon' => 'max-width: {{SIZE}}{{UNIT}}',
289 - ],
290 - ]
291 - );
292 262
293 263 $this->end_controls_section();
294 264 /* END special for some elements */
295 265 }