| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | ], |
| 56 | 56 | 'animation', // hover animations |
| 57 | 57 | 'entrance', // entrance basic style |
| 58 | 58 | ]; |
| 59 | - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ | |
| 59 | + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) { | |
| 60 | 60 | $styles['e-animations'] = [ // entrance animations |
| 61 | 61 | 'external' => true, |
| 62 | 62 | ]; |
| 63 | 63 | } |
| @@ -66,12 +66,13 @@ | ||
| 66 | 66 | public function get_scripts() |
| 67 | 67 | { |
| 68 | 68 | return $this->TRAIT_get_carousel_scripts(); |
| 69 | 69 | } |
| 70 | - // TODO: remove or set as false, after 3.30, when the full deprecation of widget innet wrapper is ready | |
| 71 | - public function has_widget_inner_wrapper(): bool { | |
| 72 | - return true; | |
| 73 | - } | |
| 70 | + public function has_widget_inner_wrapper(): bool | |
| 71 | + { | |
| 72 | + // TODO: remove after Optmized Markup experiment is merged to the core | |
| 73 | + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup'); | |
| 74 | + } | |
| 74 | 75 | |
| 75 | 76 | private function filter_missing_taxonomies($settings) |
| 76 | 77 | { |
| 77 | 78 | $taxonomy_filter_args = [ |
| @@ -123,18 +124,18 @@ | ||
| 123 | 124 | [ |
| 124 | 125 | 'label' => esc_html__('Carousel', 'uicore-elements'), |
| 125 | 126 | ] |
| 126 | 127 | ); |
| 127 | - $this->TRAIT_register_carousel_additional_controls(); // Grid Layouts with old masonry control | |
| 128 | + $this->TRAIT_register_carousel_additional_controls(); // Grid Layouts with old masonry control | |
| 128 | 129 | $this->end_controls_section(); |
| 129 | 130 | |
| 130 | 131 | $this->start_controls_section( |
| 131 | - 'section_carousel_settings', | |
| 132 | - [ | |
| 133 | - 'label' => __('Carousel Settings', 'uicore-elements'), | |
| 134 | - ] | |
| 135 | - ); | |
| 136 | - $this->TRAIT_register_carousel_settings_controls(); // Carousel settings | |
| 132 | + 'section_carousel_settings', | |
| 133 | + [ | |
| 134 | + 'label' => __('Carousel Settings', 'uicore-elements'), | |
| 135 | + ] | |
| 136 | + ); | |
| 137 | + $this->TRAIT_register_carousel_settings_controls(); // Carousel settings | |
| 137 | 138 | $this->end_controls_section(); |
| 138 | 139 | |
| 139 | 140 | $this->TRAIT_register_navigation_controls(); |
| 140 | 141 | $this->TRAIT_register_post_item_controls(); |
| @@ -157,19 +158,19 @@ | ||
| 157 | 158 | 'label' => __('Animations', 'uicore-elements'), |
| 158 | 159 | 'tab' => Controls_Manager::TAB_STYLE, |
| 159 | 160 | ] |
| 160 | 161 | ); |
| 161 | - $this->TRAIT_register_entrance_animations_controls(); | |
| 162 | - $this->TRAIT_register_hover_animation_control( | |
| 163 | - 'Item Hover Animation', | |
| 164 | - [], | |
| 165 | - ['underline'], | |
| 166 | - ); | |
| 167 | - $this->TRAIT_register_post_animation_controls(); | |
| 162 | + $this->TRAIT_register_entrance_animations_controls(); | |
| 163 | + $this->TRAIT_register_hover_animation_control( | |
| 164 | + 'Item Hover Animation', | |
| 165 | + [], | |
| 166 | + ['underline'], | |
| 167 | + ); | |
| 168 | + $this->TRAIT_register_post_animation_controls(); | |
| 168 | 169 | $this->end_controls_section(); |
| 169 | 170 | |
| 170 | 171 | // Update post component controls |
| 171 | - $this->update_control('image_size', [ | |
| 172 | + $this->update_responsive_control('image_size', [ | |
| 172 | 173 | 'condition' => [], |
| 173 | 174 | ]); |
| 174 | 175 | $this->update_control('content_padding', [ |
| 175 | 176 | 'default' => [ |
| @@ -181,20 +182,27 @@ | ||
| 181 | 182 | ], |
| 182 | 183 | ]); |
| 183 | 184 | $this->update_control('item_limit', [ |
| 184 | 185 | 'default' => [ |
| 185 | - 'size' => 5, | |
| 186 | + 'size' => 4, | |
| 186 | 187 | ], |
| 187 | 188 | ]); |
| 189 | + | |
| 190 | + // TODO: create new method to return animations list and use it throughout the plugin | |
| 191 | + // Update carousel animations | |
| 192 | + $this->update_control('animation_style', [ | |
| 193 | + 'options' => [ | |
| 194 | + 'circular' => esc_html__('Circular', 'uicore-elements'), | |
| 195 | + 'fade_blur' => esc_html__('Fade Blur', 'uicore-elements'), | |
| 196 | + 'default' => esc_html__('Default', 'uicore-elements'), | |
| 197 | + ], | |
| 198 | + ]); | |
| 188 | 199 | } |
| 189 | 200 | |
| 190 | - function content_template() | |
| 191 | - { | |
| 192 | - } | |
| 201 | + function content_template() {} | |
| 193 | 202 | |
| 194 | 203 | protected function render() |
| 195 | 204 | { |
| 196 | - | |
| 197 | 205 | // Get query args, settings and post type slug |
| 198 | 206 | global $wp_query; |
| 199 | 207 | $default_query = $wp_query; |
| 200 | 208 | $settings = $this->get_settings(); |
| @@ -202,21 +210,14 @@ | ||
| 202 | 210 | // Get the quantity of items and creates a loop control |
| 203 | 211 | $items = $settings['item_limit']['size']; |
| 204 | 212 | $loops = 0; |
| 205 | 213 | |
| 206 | - // Check if should duplicate slides and update settings | |
| 207 | - if ( $this->TRAIT_should_duplicate_slides($items) ) { | |
| 208 | - $diff = abs($this->TRAIT_get_duplication_diff($items) + 1); // +1 to fix zero based index | |
| 209 | - $settings['item_limit']['size'] = $items + $diff; | |
| 210 | - } | |
| 214 | + $this->TRAIT_render_center_loop_warning($items); | |
| 211 | 215 | |
| 212 | 216 | // Build query |
| 213 | - $this->TRAIT_query_posts( $settings, $wp_query->query ); | |
| 217 | + $this->TRAIT_query_posts($settings, $wp_query->query); | |
| 214 | 218 | $wp_query = $this->get_query(); |
| 215 | 219 | |
| 216 | - // SVG icon experiment font-size adjustment | |
| 217 | - $this->TRAIT_set_meta_font_size_to_svg($settings); | |
| 218 | - | |
| 219 | 220 | $this->TRAIT_render_filters($settings); |
| 220 | 221 | |
| 221 | 222 | // No posts found |
| 222 | 223 | if (!$wp_query->have_posts()) { |
| @@ -222,29 +223,29 @@ | ||
| 222 | 223 | if (!$wp_query->have_posts()) { |
| 223 | 224 | echo '<p style="text-align:center">' . esc_html__('No posts found.', 'uicore-elements') . '</p>'; |
| 224 | 225 | } else { |
| 225 | 226 | |
| 226 | - ?> | |
| 227 | - <div class="ui-e-carousel swiper"> | |
| 228 | - <div class='swiper-wrapper'> | |
| 229 | - <?php | |
| 230 | - while ($wp_query->have_posts()) { | |
| 227 | +?> | |
| 228 | + <div class="ui-e-carousel swiper"> | |
| 229 | + <div class='swiper-wrapper'> | |
| 230 | + <?php | |
| 231 | + while ($wp_query->have_posts()) { | |
| 231 | 232 | |
| 232 | - // sticky posts disregards posts per page, so ending the loop if $items == $loop forces the query respects the users item limit | |
| 233 | - // if ($settings['sticky'] && $items == $loops) { | |
| 234 | - // break; | |
| 235 | - // } | |
| 233 | + // sticky posts disregards posts per page, so ending the loop if $items == $loop forces the query respects the users item limit | |
| 234 | + // if ($settings['sticky'] && $items == $loops) { | |
| 235 | + // break; | |
| 236 | + // } | |
| 236 | 237 | |
| 237 | - $wp_query->the_post(); | |
| 238 | - $this->TRAIT_render_item($loops, true); | |
| 238 | + $wp_query->the_post(); | |
| 239 | + $this->TRAIT_render_item($loops, true); | |
| 239 | 240 | |
| 240 | - $loops++; | |
| 241 | - } | |
| 242 | - ?> | |
| 243 | - </div> | |
| 241 | + $loops++; | |
| 242 | + } | |
| 243 | + ?> | |
| 244 | 244 | </div> |
| 245 | - <?php $this->TRAIT_render_carousel_navigations(); ?> | |
| 246 | - <?php | |
| 245 | + </div> | |
| 246 | + <?php $this->TRAIT_render_carousel_navigations($items); ?> | |
| 247 | +<?php | |
| 247 | 248 | } |
| 248 | 249 | |
| 249 | 250 | //reset query |
| 250 | 251 | wp_reset_query(); |