| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements; |
| 4 | + | |
| 3 | 5 | use Elementor\Plugin; |
| 4 | 6 | |
| 5 | 7 | defined('ABSPATH') || exit(); |
| 6 | 8 | |
| @@ -10,9 +12,10 @@ | ||
| 10 | 12 | * @author Lucas Marini Falbo <[email protected]> |
| 11 | 13 | * @since 1.0.7 |
| 12 | 14 | */ |
| 13 | 15 | |
| 14 | -class CustomSlider extends CustomCarousel { | |
| 16 | +class CustomSlider extends CustomCarousel | |
| 17 | +{ | |
| 15 | 18 | |
| 16 | 19 | public function get_name() |
| 17 | 20 | { |
| 18 | 21 | return 'uicore-custom-slider'; |
| @@ -36,12 +39,13 @@ | ||
| 36 | 39 | public function get_styles() |
| 37 | 40 | { |
| 38 | 41 | $styles = [ |
| 39 | 42 | 'custom-slider', |
| 43 | + 'carousel', | |
| 40 | 44 | 'animation', // hover animations |
| 41 | 45 | 'entrance', // entrance basic style |
| 42 | 46 | ]; |
| 43 | - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ | |
| 47 | + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) { | |
| 44 | 48 | $styles['e-animations'] = [ // entrance animations |
| 45 | 49 | 'external' => true, |
| 46 | 50 | ]; |
| 47 | 51 | } |
| @@ -51,50 +55,38 @@ | ||
| 51 | 55 | protected function register_controls(bool $is_slider = false) |
| 52 | 56 | { |
| 53 | 57 | |
| 54 | 58 | parent::register_controls(true); // inherit original controls and enables slider height |
| 59 | + $this->TRAIT_update_slider_controls(); | |
| 55 | 60 | |
| 56 | 61 | // Change default border radius to zero |
| 57 | - $this->update_control( 'item_border_radius', [ | |
| 58 | - 'default' => [ | |
| 59 | - 'top' => 0, | |
| 60 | - 'right' => 0, | |
| 61 | - 'bottom' => 0, | |
| 62 | - 'left' => 0, | |
| 63 | - 'unit' => 'px', | |
| 64 | - 'isLinked' => true, | |
| 65 | - ], | |
| 66 | - ]); | |
| 67 | - // Add special animation slide | |
| 68 | - $this->update_control('animation_style',[ | |
| 69 | - 'default' => 'fade', | |
| 70 | - 'options' => [ | |
| 71 | - 'coverflow' => esc_html__('Coverflow', 'uicore-elements'), | |
| 72 | - 'fade' => esc_html__('Fade', 'uicore-elements'), | |
| 73 | - 'cards' => esc_html__('Cards', 'uicore-elements'), | |
| 74 | - 'flip' => esc_html__('Flip', 'uicore-elements'), | |
| 75 | - 'creative' => esc_html__('Creative', 'uicore-elements'), | |
| 76 | - 'stacked' => esc_html__('Stacked', 'uicore-elements'), | |
| 62 | + $this->update_control( | |
| 63 | + 'item_border_radius', | |
| 64 | + [ | |
| 65 | + 'default' => [ | |
| 66 | + 'top' => 0, | |
| 67 | + 'right' => 0, | |
| 68 | + 'bottom' => 0, | |
| 69 | + 'left' => 0, | |
| 70 | + 'unit' => 'px', | |
| 71 | + 'isLinked' => true, | |
| 72 | + ], | |
| 77 | 73 | ] |
| 78 | - ]); | |
| 74 | + ); | |
| 75 | + | |
| 79 | 76 | // Decrease default item padding |
| 80 | - $this->update_control('item_padding', [ | |
| 81 | - 'default' => [ | |
| 82 | - 'top' => 25, | |
| 83 | - 'right' => 25, | |
| 84 | - 'bottom' => 25, | |
| 85 | - 'left' => 25, | |
| 86 | - 'unit' => 'px', | |
| 87 | - 'isLinked' => true, | |
| 88 | - ], | |
| 89 | - ]); | |
| 90 | - | |
| 91 | - // Remove controls that are meant for carousel, not slide type widgets | |
| 92 | - $this->remove_responsive_control('slides_per_view'); | |
| 93 | - $this->remove_control('show_hidden'); | |
| 94 | - $this->remove_control('fade_edges'); | |
| 95 | - $this->remove_control('fade_edges_alert'); | |
| 96 | - $this->remove_control('match_height'); | |
| 97 | - $this->remove_control('carousel_gap'); | |
| 77 | + $this->update_control( | |
| 78 | + 'item_padding', | |
| 79 | + [ | |
| 80 | + 'default' => [ | |
| 81 | + 'top' => 25, | |
| 82 | + 'right' => 25, | |
| 83 | + 'bottom' => 25, | |
| 84 | + 'left' => 25, | |
| 85 | + 'unit' => 'px', | |
| 86 | + 'isLinked' => true, | |
| 87 | + ], | |
| 88 | + ] | |
| 89 | + ); | |
| 98 | 90 | } |
| 99 | 91 | } |
| 100 | -\Elementor\Plugin::instance()->widgets_manager->register(new CustomSlider()); | |
| 92 | +\Elementor\Plugin::instance()->widgets_manager->register(new CustomSlider()); | |