← All changes
|
elementor-elements/classes/wdk-locations-carousel.php
+29
-11
1.1.8
→
1.5.9
View file →
| @@ -29,8 +29,9 @@ | ||
| 29 | 29 | \Elementor\Controls_Manager::add_tab( |
| 30 | 30 | 'tab_conf', |
| 31 | 31 | esc_html__('Settings', 'wpdirectorykit') |
| 32 | 32 | ); |
| 33 | + | |
| 33 | 34 | |
| 34 | 35 | \Elementor\Controls_Manager::add_tab( |
| 35 | 36 | 'tab_layout', |
| 36 | 37 | esc_html__('Layout', 'wpdirectorykit') |
| @@ -130,9 +131,9 @@ | ||
| 130 | 131 | |
| 131 | 132 | $locations_ids = array(); |
| 132 | 133 | foreach($this->data['settings']['conf_custom_results'] as $location) { |
| 133 | 134 | if(isset($location['location_id']) && !empty($location['location_id'])) { |
| 134 | - $locations_ids [] = $location['location_id']; | |
| 135 | + $locations_ids [] = (int)$location['location_id']; | |
| 135 | 136 | } |
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | /* where in */ |
| @@ -149,11 +150,15 @@ | ||
| 149 | 150 | |
| 150 | 151 | } else { |
| 151 | 152 | $order_by = NULL; |
| 152 | 153 | if(!empty($this->data['settings']['conf_order_by'])) |
| 153 | - $order_by = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; | |
| 154 | + $order_by = wdk_esc_sql_order_by($this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'], $this->WMVC->{$controller.'_m'}->getAllowedOrderBy()); | |
| 154 | 155 | |
| 155 | - $this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination($this->data['settings']['conf_limit'], NULL, array(), $order_by); | |
| 156 | + $where = array(); | |
| 157 | + if (!empty($this->data['settings']['only_root_enable']) && $this->data['settings']['only_root_enable'] == 'yes') { | |
| 158 | + $where['('.$this->WMVC->{$controller.'_m'}->_table_name.'.level = 0)'] = NULL; | |
| 159 | + } | |
| 160 | + $this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination((!empty($this->data['settings']['conf_limit'])) ? $this->data['settings']['conf_limit'] : NULL, NULL, $where, $order_by); | |
| 156 | 161 | } |
| 157 | 162 | |
| 158 | 163 | $this->data['is_edit_mode']= false; |
| 159 | 164 | if(Plugin::$instance->editor->is_edit_mode()) |
| @@ -158,9 +163,9 @@ | ||
| 158 | 163 | $this->data['is_edit_mode']= false; |
| 159 | 164 | if(Plugin::$instance->editor->is_edit_mode()) |
| 160 | 165 | $this->data['is_edit_mode']= true; |
| 161 | 166 | |
| 162 | - echo $this->view('wdk-locations-carousel', $this->data); | |
| 167 | + $this->view('wdk-locations-carousel', $this->data, true); | |
| 163 | 168 | } |
| 164 | 169 | |
| 165 | 170 | private function generate_controls_conf() { |
| 166 | 171 | $this->start_controls_section( |
| @@ -180,9 +185,9 @@ | ||
| 180 | 185 | $this->add_control( |
| 181 | 186 | 'conf_link', |
| 182 | 187 | [ |
| 183 | 188 | 'label' => __( 'Open results on page', 'wpdirectorykit' ), |
| 184 | - 'type' => \Elementor\Controls_Manager::SELECT, | |
| 189 | + 'type' => \Elementor\Controls_Manager::SELECT2, | |
| 185 | 190 | 'default' => '', |
| 186 | 191 | 'options' => $pages |
| 187 | 192 | ] |
| 188 | 193 | ); |
| @@ -205,20 +210,33 @@ | ||
| 205 | 210 | 'important_note', |
| 206 | 211 | [ |
| 207 | 212 | 'label' => '', |
| 208 | 213 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 209 | - 'raw' => sprintf(__( 'Manage Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')), | |
| 214 | + /* translators: 1: URL. */ | |
| 215 | + 'raw' => wdk_sprintf(__( 'Manage Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')), | |
| 210 | 216 | 'content_classes' => 'wdk_elementor_hint', |
| 211 | 217 | ] |
| 212 | 218 | ); |
| 213 | 219 | |
| 220 | + $this->add_responsive_control( | |
| 221 | + 'only_root_enable', | |
| 222 | + [ | |
| 223 | + 'label' => esc_html__( 'Show only Root', 'wpdirectorykit' ), | |
| 224 | + 'type' => Controls_Manager::SWITCHER, | |
| 225 | + 'none' => esc_html__( 'No', 'wpdirectorykit' ), | |
| 226 | + 'block' => esc_html__( 'Yes', 'wpdirectorykit' ), | |
| 227 | + 'return_value' => 'yes', | |
| 228 | + 'default' => 'yes', | |
| 229 | + ] | |
| 230 | + ); | |
| 214 | 231 | $this->add_control( |
| 215 | 232 | 'conf_limit', |
| 216 | 233 | [ |
| 217 | 234 | 'label' => __( 'Limit Locations', 'wpdirectorykit' ), |
| 235 | + 'description' => __( 'Set 0 for unlimit', 'wpdirectorykit' ), | |
| 218 | 236 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 219 | - 'min' => 1, | |
| 220 | - 'max' => 50, | |
| 237 | + 'min' => 0, | |
| 238 | + 'max' => 500, | |
| 221 | 239 | 'step' => 1, |
| 222 | 240 | 'default' => 6, |
| 223 | 241 | 'conditions' => [ |
| 224 | 242 | 'terms' => [ |
| @@ -486,9 +504,9 @@ | ||
| 486 | 504 | |
| 487 | 505 | $this->add_control( |
| 488 | 506 | 'layout_carousel_cssease', |
| 489 | 507 | [ |
| 490 | - 'label' => __( 'cssEase ', 'wpdirectorykit' ), | |
| 508 | + 'label' => __( 'cssEase', 'wpdirectorykit' ), | |
| 491 | 509 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 492 | 510 | 'default' => 'linear', |
| 493 | 511 | 'options' => [ |
| 494 | 512 | 'linear' => __( 'linear', 'wpdirectorykit' ), |
| @@ -517,9 +535,9 @@ | ||
| 517 | 535 | |
| 518 | 536 | $this->add_responsive_control( |
| 519 | 537 | 't_styles_img_des_type', |
| 520 | 538 | [ |
| 521 | - 'label' => __( 'Design type ', 'wpdirectorykit' ), | |
| 539 | + 'label' => __( 'Design type', 'wpdirectorykit' ), | |
| 522 | 540 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 523 | 541 | 'default' => 'wdk-image_cover', |
| 524 | 542 | 'options' => [ |
| 525 | 543 | '' => __( 'Default Sizes', 'wpdirectorykit' ), |
| @@ -594,9 +612,9 @@ | ||
| 594 | 612 | |
| 595 | 613 | $this->add_responsive_control( |
| 596 | 614 | 't_styles_arrows_position', |
| 597 | 615 | [ |
| 598 | - 'label' => __( 'Position ', 'wpdirectorykit' ), | |
| 616 | + 'label' => __( 'Position', 'wpdirectorykit' ), | |
| 599 | 617 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 600 | 618 | 'default' => 'wdk-locations-carousel_arrows_bottom', |
| 601 | 619 | 'options' => [ |
| 602 | 620 | 'wdk-locations-carousel_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ), |