← All changes
|
elementor-elements/classes/wdk-listings-carousel.php
+101
-13
1.3.0
→
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, |
| @@ -652,8 +684,17 @@ | ||
| 652 | 684 | 'tab' => Controls_Manager::TAB_STYLE, |
| 653 | 685 | ] |
| 654 | 686 | ); |
| 655 | 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 | + | |
| 656 | 697 | $this->add_responsive_control( |
| 657 | 698 | 'styles_thmbn_des_type', |
| 658 | 699 | [ |
| 659 | 700 | 'label' => __( 'Design type', 'wpdirectorykit' ), |
| @@ -680,9 +721,9 @@ | ||
| 680 | 721 | 'min' => 0, |
| 681 | 722 | 'max' => 100, |
| 682 | 723 | ], |
| 683 | 724 | ], |
| 684 | - 'size_units' => [ 'px', 'vw' ], | |
| 725 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 685 | 726 | 'default' => [ |
| 686 | 727 | 'size' => 350, |
| 687 | 728 | 'unit' => 'px', |
| 688 | 729 | ], |
| @@ -1099,18 +1140,36 @@ | ||
| 1099 | 1140 | '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};', |
| 1100 | 1141 | ], |
| 1101 | 1142 | ] |
| 1102 | 1143 | ); |
| 1103 | - $selectors = array( | |
| 1104 | - 'normal' => '{{WRAPPER}} '.$item['selector'], | |
| 1105 | - '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 | + ] | |
| 1106 | 1171 | ); |
| 1107 | - | |
| 1108 | - if(isset($item['is_featured'])) { | |
| 1109 | - $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured']; | |
| 1110 | - } | |
| 1111 | - $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); | |
| 1112 | - | |
| 1113 | 1172 | /* special for some elements */ |
| 1114 | 1173 | if ($item['key'] == 'content_description') { |
| 1115 | 1174 | |
| 1116 | 1175 | $this->add_control( |
| @@ -1126,10 +1185,39 @@ | ||
| 1126 | 1185 | '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};', |
| 1127 | 1186 | ], |
| 1128 | 1187 | ] |
| 1129 | 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 | + } | |
| 1130 | 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']; | |
| 1131 | 1215 | } |
| 1216 | + $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']); | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1132 | 1220 | if($item['key'] == 'content_button') { |
| 1133 | 1221 | $this->add_control( |
| 1134 | 1222 | $item['key'].'_icon', |
| 1135 | 1223 | [ |