← All changes
|
elementor-elements/classes/wdk-listing-fields-section.php
+40
-15
1.1.0
→
1.5.9
View file →
| @@ -81,9 +81,9 @@ | ||
| 81 | 81 | */ |
| 82 | 82 | public function get_name() { |
| 83 | 83 | return 'wdk-listing-fields-section'; |
| 84 | 84 | } |
| 85 | - | |
| 85 | + | |
| 86 | 86 | /** |
| 87 | 87 | * Retrieve the widget title. |
| 88 | 88 | * |
| 89 | 89 | * @since 1.1.0 |
| @@ -137,9 +137,9 @@ | ||
| 137 | 137 | * |
| 138 | 138 | * @access protected |
| 139 | 139 | */ |
| 140 | 140 | protected function render() { |
| 141 | - parent::render(); | |
| 141 | + | |
| 142 | 142 | global $wdk_listing_id; |
| 143 | 143 | |
| 144 | 144 | $this->data['id_element'] = $this->get_id(); |
| 145 | 145 | $this->data['settings'] = $this->get_settings(); |
| @@ -161,19 +161,27 @@ | ||
| 161 | 161 | |
| 162 | 162 | $this->data['is_edit_mode']= false; |
| 163 | 163 | if(Plugin::$instance->editor->is_edit_mode()){ |
| 164 | 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 | + } | |
| 165 | 170 | } else { |
| 166 | - | |
| 167 | 171 | if(empty($this->data['section_data'])){ |
| 168 | - echo '<p class="wdk_alert wdk_alert-danger">'.sprintf(esc_html__('Section #%1$s not found', 'wpdirectorykit'), $this->data['settings']['section_id']).'</p>'; | |
| 169 | 172 | return false; |
| 170 | - } | |
| 173 | + } | |
| 171 | 174 | |
| 172 | 175 | /* return false if no content */ |
| 173 | 176 | if($this->data['settings']['hide_onempty_complete'] == 'yes') { |
| 174 | 177 | $complete_empty = true; |
| 175 | 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 | + | |
| 176 | 184 | if(!empty(wdk_field_value (wmvc_show_data('idfield', $field), $wdk_listing_id))){ |
| 177 | 185 | $complete_empty = false; |
| 178 | 186 | break; |
| 179 | 187 | } |
| @@ -183,9 +191,10 @@ | ||
| 183 | 191 | return false; |
| 184 | 192 | } |
| 185 | 193 | } |
| 186 | 194 | |
| 187 | - echo $this->view('wdk-listing-fields-section', $this->data); | |
| 195 | + $this->view('wdk-listing-fields-section', $this->data, true); | |
| 196 | + parent::render(); | |
| 188 | 197 | } |
| 189 | 198 | |
| 190 | 199 | |
| 191 | 200 | private function generate_controls_conf() { |
| @@ -209,9 +218,9 @@ | ||
| 209 | 218 | $this->add_control( |
| 210 | 219 | 'section_id', |
| 211 | 220 | [ |
| 212 | 221 | 'label' => __( 'Section id', 'wpdirectorykit' ), |
| 213 | - 'type' => \Elementor\Controls_Manager::SELECT, | |
| 222 | + 'type' => \Elementor\Controls_Manager::SELECT2, | |
| 214 | 223 | 'default' => '', |
| 215 | 224 | 'options' => $sections_list, |
| 216 | 225 | 'separator' => 'after', |
| 217 | 226 | ] |
| @@ -275,9 +284,10 @@ | ||
| 275 | 284 | 'important_note', |
| 276 | 285 | [ |
| 277 | 286 | 'label' => '', |
| 278 | 287 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 279 | - 'raw' => sprintf(__( 'Manager Fields <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_fields')), | |
| 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')), | |
| 280 | 290 | 'content_classes' => 'wdk_elementor_hint', |
| 281 | 291 | ] |
| 282 | 292 | ); |
| 283 | 293 | |
| @@ -440,9 +450,9 @@ | ||
| 440 | 450 | 'right' => 'justify-content: flex-end;', |
| 441 | 451 | 'justify' => 'justify-content: space-between;', |
| 442 | 452 | ], |
| 443 | 453 | 'selectors' => [ |
| 444 | - '{{WRAPPER}} .wdk-listing-fields-section .wdk-col' => '{{VALUE}};', | |
| 454 | + '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};', | |
| 445 | 455 | ], |
| 446 | 456 | 'conditions' => [ |
| 447 | 457 | 'terms' => [ |
| 448 | 458 | [ |
| @@ -485,9 +495,9 @@ | ||
| 485 | 495 | 'right' => 'justify-content: flex-start;', |
| 486 | 496 | 'justify' => 'justify-content: space-between;', |
| 487 | 497 | ], |
| 488 | 498 | 'selectors' => [ |
| 489 | - '{{WRAPPER}} .wdk-listing-fields-section .wdk-col' => '{{VALUE}};', | |
| 499 | + '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};', | |
| 490 | 500 | ], |
| 491 | 501 | 'conditions' => [ |
| 492 | 502 | 'terms' => [ |
| 493 | 503 | [ |
| @@ -526,9 +536,9 @@ | ||
| 526 | 536 | 'center' => 'align-items: center;', |
| 527 | 537 | 'right' => 'align-items: flex-end;', |
| 528 | 538 | ], |
| 529 | 539 | 'selectors' => [ |
| 530 | - '{{WRAPPER}} .wdk-listing-fields-section .wdk-col' => '{{VALUE}};', | |
| 540 | + '{{WRAPPER}} .wdk-listing-fields-section .wdk-col .field-group' => '{{VALUE}};', | |
| 531 | 541 | ], |
| 532 | 542 | 'conditions' => [ |
| 533 | 543 | 'terms' => [ |
| 534 | 544 | [ |
| @@ -565,9 +575,9 @@ | ||
| 565 | 575 | 'default' => 'yes', |
| 566 | 576 | ] |
| 567 | 577 | ); |
| 568 | 578 | |
| 569 | - $this->add_responsive_control ( | |
| 579 | + $this->add_responsive_control ( | |
| 570 | 580 | 'field_group_icon_max_heigth', |
| 571 | 581 | [ |
| 572 | 582 | 'label' => esc_html__('Max Height', 'wpdirectorykit'), |
| 573 | 583 | 'type' => Controls_Manager::SLIDER, |
| @@ -835,15 +845,15 @@ | ||
| 835 | 845 | ], |
| 836 | 846 | [ |
| 837 | 847 | 'key'=>'field_suffix', |
| 838 | 848 | 'label'=> esc_html__('Field Suffix', 'wpdirectorykit'), |
| 839 | - 'selector'=>'.field_value .value', | |
| 849 | + 'selector'=>'.field_value .suffix', | |
| 840 | 850 | 'options'=>['margin','typo','color','padding','transition'], |
| 841 | 851 | ], |
| 842 | 852 | [ |
| 843 | 853 | 'key'=>'field_value', |
| 844 | 854 | 'label'=> esc_html__('Field Value', 'wpdirectorykit'), |
| 845 | - 'selector'=>'.field_value .suffix', | |
| 855 | + 'selector'=>'.field_value .value', | |
| 846 | 856 | 'options'=>['margin','typo','color','padding','transition'], |
| 847 | 857 | ] |
| 848 | 858 | ]; |
| 849 | 859 | |
| @@ -896,9 +906,24 @@ | ||
| 896 | 906 | 'type' => Controls_Manager::HEADING, |
| 897 | 907 | 'separator' => 'before', |
| 898 | 908 | ] |
| 899 | 909 | ); |
| 900 | - | |
| 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 | + | |
| 901 | 926 | $this->add_responsive_control( |
| 902 | 927 | 'field_checkbox_position', |
| 903 | 928 | [ |
| 904 | 929 | 'label' => __( 'Columns', 'wpdirectorykit' ), |