* @since 1.0.1 */ class LogoCarousel extends UiCoreWidget { use Carousel_Trait; use Logo_Trait; use Animation_Trait; public function get_name() { return 'uicore-logo-carousel'; } public function get_title() { return esc_html__('Logo Carousel', 'uicore-elements'); } public function get_icon() { return 'eicon-logo ui-e-widget'; } public function get_categories() { return ['uicore']; } public function get_keywords() { return ['logo', 'client', 'brand', 'showcase', 'carousel', 'slide']; } public function get_styles() { return [ 'logo-carousel', 'animation', 'entrance', 'e-animations' => [ 'condition' => [ 'animation_assets' => 'false' ], 'external' => true, ] ]; } public function get_scripts() { return [ 'carousel', 'entrance' => [ 'condition' => [ 'animate_items' => 'ui-e-grid-animate' ], ] ]; } protected function register_controls() { $this->register_logo_repeater_controls('Logo Carousel Items'); // Repeater Controls $this->start_controls_section( 'section_carousel_settings', [ 'label' => __('Carousel Settings', 'uicore-elements'), ] ); $this->TRAIT_register_entrace_asset_helper(); // Animation asset condition $this->register_carousel_additional_controls(); // Carousel Additionals $this->register_logo_adittional_controls(false); // Logo Additionals without height control since carousel has it's own $this->add_control('add_carousel_divider',['type' => Controls_Manager::DIVIDER,]); $this->register_carousel_settings_controls(); // Carousel settings $this->end_controls_section(); $this->register_navigation_controls(); // Navigation settings $this->start_controls_section( 'section_style_review_items', [ 'label' => esc_html__( 'Logo Carousel', 'uicore-elements' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_item_style' ); $this->start_controls_tab( 'tab_item_normal', [ 'label' => esc_html__( 'Normal', 'uicore-elements' ), ] ); $this->register_carousel_normal_item_style_controls(false); $this->register_logos_image_style_controls('normal'); $this->end_controls_tab(); $this->start_controls_tab( 'tab_item_hover', [ 'label' => esc_html__( 'Hover', 'uicore-elements' ), ] ); $this->register_carousel_hover_item_style_controls(false); $this->register_logos_image_style_controls('hover'); $this->end_controls_tab(); $this->start_controls_tab( 'tab_item_active', [ 'label' => esc_html__( 'Active', 'uicore-elements' ), ] ); $this->register_carousel_active_item_style_controls(false); $this->register_logos_image_style_controls('active'); $this->end_controls_tabs(); $this->end_controls_tabs(); // Necessary because register_testimonial_card_controls() OPENS but DON'T close start_controls_tabs() $this->end_controls_section(); $this->register_navigation_style_controls(); // Carousel Navigation Styles $this->start_controls_section( 'section_style_animations', [ 'label' => __('Animations', 'uicore-elements'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->TRAIT_register_entrance_animations_controls(); $this->TRAIT_register_hover_animation_control( 'Item Hover Animation', [], ['underline'] ); $this->TRAIT_register_hover_animation_control( 'Logo Hover Animation', [], ['underline'] ); $this->end_controls_section(); } public function render() { $ID = $this->get_ID(); $settings = $this->get_settings_for_display(); $this->add_render_attribute('review-carousel', 'class', ['ui-e-carousel', "carousel-$ID"]); ?>
print_render_attribute_string('review-carousel'); ?>> render_logo_item(); if(in_array('arrows', $settings['navigation'])) { $this->render_carousel_arrows(); } if(in_array('fraction', $settings['navigation'])) { $this->render_carousel_fraction(); } ?>
widgets_manager->register(new LogoCarousel());