← All changes
|
elementor-elements/classes/wdk-listings-carousel.php
+121
-23
1.2.8
→
1.5.9
View file →
| @@ -14,8 +14,9 @@ | ||
| 14 | 14 | use Elementor\Icons_Manager; |
| 15 | 15 | use Elementor\Group_Control_Typography; |
| 16 | 16 | use Elementor\Group_Control_Border; |
| 17 | 17 | use Elementor\Group_Control_Box_Shadow; |
| 18 | +use Elementor\Group_Control_Image_Size; | |
| 18 | 19 | |
| 19 | 20 | if (!defined('ABSPATH')) |
| 20 | 21 | exit; // Exit if accessed directly |
| 21 | 22 | |
| @@ -124,9 +125,10 @@ | ||
| 124 | 125 | $this->data['results'] = array(); |
| 125 | 126 | $this->data['pagination_output'] = ''; |
| 126 | 127 | $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by', 'is_featured', 'address'); |
| 127 | 128 | $custom_parameters = array(); |
| 128 | - | |
| 129 | + $skip_postget = TRUE; | |
| 130 | + | |
| 129 | 131 | if($this->data['settings']['conf_results_type'] == 'results_listings') { |
| 130 | 132 | $controller = 'listing'; |
| 131 | 133 | $offset = NULL; |
| 132 | 134 | |
| @@ -147,11 +149,17 @@ | ||
| 147 | 149 | |
| 148 | 150 | if($this->data['settings']['only_is_featured'] == 'yes') { |
| 149 | 151 | $custom_parameters['is_featured'] = 'on'; |
| 150 | 152 | } |
| 153 | + | |
| 154 | + | |
| 155 | + if(wmvc_show_data('get_filters_enable', $this->data['settings']) == 'yes') { | |
| 156 | + $skip_postget = FALSE; | |
| 157 | + } | |
| 158 | + | |
| 151 | 159 | $external_columns = array('location_id', 'category_id', 'post_title', 'is_featured'); |
| 152 | 160 | |
| 153 | - wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, TRUE); | |
| 161 | + wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters, $skip_postget); | |
| 154 | 162 | $this->data['results'] = $this->WMVC->listing_m->get_pagination($this->data['settings']['conf_limit'], $offset, array('is_activated' => 1,'is_approved'=>1)); |
| 155 | 163 | |
| 156 | 164 | } else if($this->data['settings']['conf_results_type'] == 'custom_listings') { |
| 157 | 165 | $listings_ids = array(); |
| @@ -176,9 +184,9 @@ | ||
| 176 | 184 | $this->data['is_edit_mode'] = false; |
| 177 | 185 | if(Plugin::$instance->editor->is_edit_mode()) |
| 178 | 186 | $this->data['is_edit_mode'] = true; |
| 179 | 187 | |
| 180 | - echo $this->view('wdk-listings-carousel', $this->data); | |
| 188 | + $this->view('wdk-listings-carousel', $this->data, true); | |
| 181 | 189 | |
| 182 | 190 | } |
| 183 | 191 | |
| 184 | 192 | |
| @@ -209,8 +217,9 @@ | ||
| 209 | 217 | 'important_note', |
| 210 | 218 | [ |
| 211 | 219 | 'label' => '', |
| 212 | 220 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 221 | + /* translators: 1: URL. */ | |
| 213 | 222 | 'raw' => wdk_sprintf(__( 'Edit Result Card Designer <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_resultitem')), |
| 214 | 223 | 'content_classes' => 'wdk_elementor_hint', |
| 215 | 224 | 'separator' => 'after', |
| 216 | 225 | ] |
| @@ -220,8 +229,9 @@ | ||
| 220 | 229 | 'important_note2', |
| 221 | 230 | [ |
| 222 | 231 | 'label' => '', |
| 223 | 232 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 233 | + /* translators: 1: URL. */ | |
| 224 | 234 | 'raw' => wdk_sprintf(__( 'Manage Listings <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk')), |
| 225 | 235 | 'content_classes' => 'wdk_elementor_hint', |
| 226 | 236 | 'separator' => 'after', |
| 227 | 237 | ] |
| @@ -246,9 +256,31 @@ | ||
| 246 | 256 | ], |
| 247 | 257 | ] |
| 248 | 258 | ); |
| 249 | 259 | |
| 260 | + | |
| 250 | 261 | $this->add_control( |
| 262 | + 'get_filters_enable', | |
| 263 | + [ | |
| 264 | + 'label' => __( 'Filtering based on URL enable', 'wpdirectorykit' ), | |
| 265 | + 'type' => \Elementor\Controls_Manager::SWITCHER, | |
| 266 | + 'label_on' => __( 'True', 'wpdirectorykit' ), | |
| 267 | + 'label_off' => __( 'False', 'wpdirectorykit' ), | |
| 268 | + 'return_value' => 'yes', | |
| 269 | + 'default' => '', | |
| 270 | + 'conditions' => [ | |
| 271 | + 'terms' => [ | |
| 272 | + [ | |
| 273 | + 'name' => 'conf_results_type', | |
| 274 | + 'operator' => '==', | |
| 275 | + 'value' => 'results_listings', | |
| 276 | + ] | |
| 277 | + ], | |
| 278 | + ], | |
| 279 | + ] | |
| 280 | + ); | |
| 281 | + | |
| 282 | + $this->add_control( | |
| 251 | 283 | 'conf_limit', |
| 252 | 284 | [ |
| 253 | 285 | 'label' => __( 'Limit Results', 'wpdirectorykit' ), |
| 254 | 286 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| @@ -305,9 +337,9 @@ | ||
| 305 | 337 | |
| 306 | 338 | $this->add_control( |
| 307 | 339 | 'conf_order_by', |
| 308 | 340 | [ |
| 309 | - 'label' => __('Default Order By Column', 'wpdirectorykit'), | |
| 341 | + 'label' => __('Default Sort By Column', 'wpdirectorykit'), | |
| 310 | 342 | 'type' => Controls_Manager::SELECT, |
| 311 | 343 | 'label_block' => true, |
| 312 | 344 | 'options' => [ |
| 313 | 345 | 'none' => __('None', 'wpdirectorykit'), |
| @@ -329,9 +361,9 @@ | ||
| 329 | 361 | |
| 330 | 362 | $this->add_control( |
| 331 | 363 | 'conf_order_by_custom', |
| 332 | 364 | [ |
| 333 | - 'label' => __('Default Custom Order By (Column)', 'wpdirectorykit'), | |
| 365 | + 'label' => __('Default Custom Sort By (Column)', 'wpdirectorykit'), | |
| 334 | 366 | 'description' => '<span style="word-break: break-all;">'.__( 'Example:', 'wpdirectorykit' ). |
| 335 | 367 | '<br> field_13_NUMBER - where 13 is field id, NUMBER - field type'. |
| 336 | 368 | '<br> field_4_NUMBER - where 4 is field id, NUMBER - field type'. |
| 337 | 369 | '<br> field_6_DROPDOWN - where 6 is field id, DROPDOWN - field type'. |
| @@ -531,8 +563,26 @@ | ||
| 531 | 563 | ); |
| 532 | 564 | } |
| 533 | 565 | |
| 534 | 566 | |
| 567 | + $this->add_control( | |
| 568 | + 'basic_el_header_1', | |
| 569 | + [ | |
| 570 | + 'label' => esc_html__('Text', 'wpdirectorykit'), | |
| 571 | + 'type' => Controls_Manager::HEADING, | |
| 572 | + 'separator' => 'before', | |
| 573 | + ] | |
| 574 | + ); | |
| 575 | + | |
| 576 | + $this->add_control( | |
| 577 | + 'content_button_text', | |
| 578 | + [ | |
| 579 | + 'label' => __( 'Button Open Text', 'wpdirectorykit' ), | |
| 580 | + 'type' => \Elementor\Controls_Manager::TEXT, | |
| 581 | + 'default' => '', | |
| 582 | + ] | |
| 583 | + ); | |
| 584 | + | |
| 535 | 585 | $this->end_controls_section(); |
| 536 | 586 | |
| 537 | 587 | $this->start_controls_section( |
| 538 | 588 | 'layout_carousel_sec', |
| @@ -634,8 +684,17 @@ | ||
| 634 | 684 | 'tab' => Controls_Manager::TAB_STYLE, |
| 635 | 685 | ] |
| 636 | 686 | ); |
| 637 | 687 | |
| 688 | + $this->add_group_control( | |
| 689 | + Group_Control_Image_Size::get_type(), | |
| 690 | + [ | |
| 691 | + 'name' => 'thumbnail_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`. | |
| 692 | + 'default' => 'full', | |
| 693 | + 'separator' => 'none', | |
| 694 | + ] | |
| 695 | + ); | |
| 696 | + | |
| 638 | 697 | $this->add_responsive_control( |
| 639 | 698 | 'styles_thmbn_des_type', |
| 640 | 699 | [ |
| 641 | 700 | 'label' => __( 'Design type', 'wpdirectorykit' ), |
| @@ -662,9 +721,9 @@ | ||
| 662 | 721 | 'min' => 0, |
| 663 | 722 | 'max' => 100, |
| 664 | 723 | ], |
| 665 | 724 | ], |
| 666 | - 'size_units' => [ 'px', 'vw' ], | |
| 725 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 667 | 726 | 'default' => [ |
| 668 | 727 | 'size' => 350, |
| 669 | 728 | 'unit' => 'px', |
| 670 | 729 | ], |
| @@ -1081,18 +1140,36 @@ | ||
| 1081 | 1140 | '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};', |
| 1082 | 1141 | ], |
| 1083 | 1142 | ] |
| 1084 | 1143 | ); |
| 1085 | - $selectors = array( | |
| 1086 | - 'normal' => '{{WRAPPER}} '.$item['selector'], | |
| 1087 | - 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s' | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + $this->add_responsive_control( | |
| 1147 | + $item['key'].'_min-height', | |
| 1148 | + [ | |
| 1149 | + 'label' => esc_html__('Min Height', 'wpdirectorykit'), | |
| 1150 | + 'type' => Controls_Manager::SLIDER, | |
| 1151 | + 'range' => [ | |
| 1152 | + 'px' => [ | |
| 1153 | + 'min' => 10, | |
| 1154 | + 'max' => 1500, | |
| 1155 | + ], | |
| 1156 | + 'vw' => [ | |
| 1157 | + 'min' => 0, | |
| 1158 | + 'max' => 100, | |
| 1159 | + ], | |
| 1160 | + '%' => [ | |
| 1161 | + 'min' => 0, | |
| 1162 | + 'max' => 100, | |
| 1163 | + ], | |
| 1164 | + ], | |
| 1165 | + 'size_units' => [ 'px', 'vw','%' ], | |
| 1166 | + 'selectors' => [ | |
| 1167 | + '{{WRAPPER}} '.$item['selector'] => 'min-height: {{SIZE}}{{UNIT}}', | |
| 1168 | + ], | |
| 1169 | + | |
| 1170 | + ] | |
| 1088 | 1171 | ); |
| 1089 | - | |
| 1090 | - if(isset($item['is_featured'])) { | |
| 1091 | - $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured']; | |
| 1092 | - } | |
| 1093 | - $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); | |
| 1094 | - | |
| 1095 | 1172 | /* special for some elements */ |
| 1096 | 1173 | if ($item['key'] == 'content_description') { |
| 1097 | 1174 | |
| 1098 | 1175 | $this->add_control( |
| @@ -1108,10 +1185,39 @@ | ||
| 1108 | 1185 | '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};', |
| 1109 | 1186 | ], |
| 1110 | 1187 | ] |
| 1111 | 1188 | ); |
| 1189 | + } | |
| 1190 | + if ($item['key'] == 'content_title') { | |
| 1191 | + | |
| 1192 | + $this->add_control( | |
| 1193 | + 'content_title_limit', | |
| 1194 | + [ | |
| 1195 | + 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ), | |
| 1196 | + 'type' => \Elementor\Controls_Manager::NUMBER, | |
| 1197 | + 'min' => 1, | |
| 1198 | + 'max' => 10, | |
| 1199 | + 'step' => 1, | |
| 1200 | + 'default' => 3, | |
| 1201 | + 'selectors' => [ | |
| 1202 | + '{{WRAPPER}} .wdk-listing-card .wdk-title span' => '-webkit-line-clamp: {{VALUE}};', | |
| 1203 | + ], | |
| 1204 | + ] | |
| 1205 | + ); | |
| 1206 | + } | |
| 1112 | 1207 | |
| 1208 | + $selectors = array( | |
| 1209 | + 'normal' => '{{WRAPPER}} '.$item['selector'], | |
| 1210 | + 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s' | |
| 1211 | + ); | |
| 1212 | + | |
| 1213 | + if(isset($item['is_featured'])) { | |
| 1214 | + $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured']; | |
| 1113 | 1215 | } |
| 1216 | + $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1114 | 1220 | if($item['key'] == 'content_button') { |
| 1115 | 1221 | $this->add_control( |
| 1116 | 1222 | $item['key'].'_icon', |
| 1117 | 1223 | [ |
| @@ -1123,16 +1229,8 @@ | ||
| 1123 | 1229 | 'library' => 'solid', |
| 1124 | 1230 | ], |
| 1125 | 1231 | ] |
| 1126 | 1232 | ); |
| 1127 | - $this->add_responsive_control( | |
| 1128 | - $item['key'].'_text', | |
| 1129 | - [ | |
| 1130 | - 'label' => __( 'Text of Link', 'wpdirectorykit' ), | |
| 1131 | - 'type' => \Elementor\Controls_Manager::TEXT, | |
| 1132 | - 'default' => '', | |
| 1133 | - ] | |
| 1134 | - ); | |
| 1135 | 1233 | |
| 1136 | 1234 | $selectors = array( |
| 1137 | 1235 | 'normal' => '{{WRAPPER}} '.$item['selector'].' i', |
| 1138 | 1236 | ); |