| @@ -164,8 +164,10 @@ | ||
| 164 | 164 | } elseif($this->data['settings']['field_id'] == 'address') { |
| 165 | 165 | $this->data['field_label'] = esc_html__('Field', 'wpdirectorykit') .' '.esc_html__('Address', 'wpdirectorykit'); |
| 166 | 166 | } elseif($this->data['settings']['field_id'] == 'post_content') { |
| 167 | 167 | $this->data['field_label'] = esc_html__('Field', 'wpdirectorykit') .' '.esc_html__('Content', 'wpdirectorykit'); |
| 168 | + } elseif($this->data['settings']['field_id'] == 'counter_views') { | |
| 169 | + $this->data['field_label'] = esc_html__('Field', 'wpdirectorykit') .' '.esc_html__('Views counter', 'wpdirectorykit'); | |
| 168 | 170 | } |
| 169 | 171 | } |
| 170 | 172 | } |
| 171 | 173 | |
| @@ -171,15 +173,26 @@ | ||
| 171 | 173 | |
| 172 | 174 | $this->data['is_edit_mode']= false; |
| 173 | 175 | if(Plugin::$instance->editor->is_edit_mode()){ |
| 174 | 176 | $this->data['is_edit_mode']= true; |
| 177 | + if(is_intval($this->data['settings']['field_id']) && wdk_field_option($this->data['settings']['field_id'], 'is_visible_frontend') != 1) { | |
| 178 | + $this->data['field_label'] .= ' <span class="dashicons dashicons-hidden" style="color:red"></span>'; | |
| 179 | + } | |
| 175 | 180 | } else { |
| 181 | + if(is_intval($this->data['settings']['field_id']) && wdk_field_option($this->data['settings']['field_id'], 'is_visible_frontend') != 1) { | |
| 182 | + return false; | |
| 183 | + } | |
| 184 | + | |
| 185 | + 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))) { | |
| 186 | + return false; | |
| 187 | + } | |
| 188 | + | |
| 176 | 189 | /* return false if no content */ |
| 177 | 190 | if($this->data['settings']['hide_onempty'] == 'yes' && wdk_field_value($this->data['settings']['field_id'], $wdk_listing_id) == '') |
| 178 | 191 | return false; |
| 179 | 192 | } |
| 180 | 193 | |
| 181 | - echo $this->view('wdk-field-label', $this->data); | |
| 194 | + $this->view('wdk-field-label', $this->data, true); | |
| 182 | 195 | } |
| 183 | 196 | |
| 184 | 197 | |
| 185 | 198 | private function generate_controls_conf() { |
| @@ -190,27 +203,12 @@ | ||
| 190 | 203 | 'tab' => '1', |
| 191 | 204 | ] |
| 192 | 205 | ); |
| 193 | 206 | |
| 194 | - $WMVC = &wdk_get_instance(); | |
| 195 | - $WMVC->model('field_m'); | |
| 196 | - $fields_data = $WMVC->field_m->get(); | |
| 207 | + $fields_data = wdk_cached_field_get(); | |
| 197 | 208 | $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit')); |
| 198 | 209 | $order_i = 0; |
| 199 | 210 | |
| 200 | - $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit'); | |
| 201 | - $fields_list [(++$order_i).'__idlisting'] = esc_html__('Id listing', 'wpdirectorykit'); | |
| 202 | - $fields_list [(++$order_i).'__post_id'] = esc_html__('Post Id', 'wpdirectorykit'); | |
| 203 | - $fields_list [(++$order_i).'__lat'] = esc_html__('Gps Lat', 'wpdirectorykit'); | |
| 204 | - $fields_list [(++$order_i).'__lng'] = esc_html__('Gps Lng', 'wpdirectorykit'); | |
| 205 | - $fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit'); | |
| 206 | - $fields_list [(++$order_i).'__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit'); | |
| 207 | - $fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit'); | |
| 208 | - $fields_list [(++$order_i).'__post_content'] = esc_html__('WP Content', 'wpdirectorykit'); | |
| 209 | - $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit'); | |
| 210 | - $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit'); | |
| 211 | - $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit'); | |
| 212 | - | |
| 213 | 211 | foreach($fields_data as $field) |
| 214 | 212 | { |
| 215 | 213 | if(wmvc_show_data('field_type', $field) == 'SECTION') { |
| 216 | 214 | $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --'; |
| @@ -221,9 +219,9 @@ | ||
| 221 | 219 | $this->add_control( |
| 222 | 220 | 'field_id', |
| 223 | 221 | [ |
| 224 | 222 | 'label' => __( 'Field id', 'wpdirectorykit' ), |
| 225 | - 'type' => \Elementor\Controls_Manager::SELECT, | |
| 223 | + 'type' => \Elementor\Controls_Manager::SELECT2, | |
| 226 | 224 | 'default' => '', |
| 227 | 225 | 'options' => $fields_list, |
| 228 | 226 | 'separator' => 'after', |
| 229 | 227 | ] |