| 1 |
<?php |
| 2 |
namespace UiCoreElements; |
| 3 |
use Elementor\Controls_Manager; |
| 4 |
use UiCoreElements\UiCoreWidget; |
| 5 |
use UiCoreElements\Utils\Carousel_Trait; |
| 6 |
use UiCoreElements\Utils\Logo_Trait; |
| 7 |
use UiCoreElements\Utils\Animation_Trait; |
| 8 |
use UicoreElements\Utils\Item_Style_Component; |
| 9 |
|
| 10 |
defined('ABSPATH') || exit(); |
| 11 |
|
| 12 |
/** |
| 13 |
* Logo Carousel |
| 14 |
* |
| 15 |
* @author Lucas Marini Falbo <lucas@uicore.co> |
| 16 |
* @since 1.0.1 |
| 17 |
*/ |
| 18 |
|
| 19 |
class LogoCarousel extends UiCoreWidget |
| 20 |
{ |
| 21 |
|
| 22 |
use Carousel_Trait; |
| 23 |
use Logo_Trait; |
| 24 |
use Animation_Trait; |
| 25 |
use Item_Style_Component; |
| 26 |
|
| 27 |
public function get_name() |
| 28 |
{ |
| 29 |
return 'uicore-logo-carousel'; |
| 30 |
} |
| 31 |
public function get_title() |
| 32 |
{ |
| 33 |
return esc_html__('Logo Carousel', 'uicore-elements'); |
| 34 |
} |
| 35 |
public function get_icon() |
| 36 |
{ |
| 37 |
return 'eicon-logo ui-e-widget'; |
| 38 |
} |
| 39 |
public function get_categories() |
| 40 |
{ |
| 41 |
return ['uicore']; |
| 42 |
} |
| 43 |
public function get_keywords() |
| 44 |
{ |
| 45 |
return ['logo', 'client', 'brand', 'showcase', 'carousel', 'slide']; |
| 46 |
} |
| 47 |
public function get_styles() |
| 48 |
{ |
| 49 |
$styles = [ |
| 50 |
'logo-carousel', |
| 51 |
'animation', // hover animations |
| 52 |
'entrance', // entrance basic style |
| 53 |
]; |
| 54 |
if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ |
| 55 |
$styles['e-animations'] = [ // entrance animations |
| 56 |
'external' => true, |
| 57 |
]; |
| 58 |
} |
| 59 |
return $styles; |
| 60 |
} |
| 61 |
public function get_scripts() |
| 62 |
{ |
| 63 |
return $this->TRAIT_get_scripts(); |
| 64 |
} |
| 65 |
protected function register_controls() |
| 66 |
{ |
| 67 |
|
| 68 |
$this->TRAIT_register_logo_repeater_controls('Logo Carousel Items'); // Repeater Controls |
| 69 |
|
| 70 |
$this->start_controls_section( |
| 71 |
'section_carousel_settings', |
| 72 |
[ |
| 73 |
'label' => __('Carousel Settings', 'uicore-elements'), |
| 74 |
] |
| 75 |
); |
| 76 |
|
| 77 |
$this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals |
| 78 |
$this->TRAIT_register_logo_adittional_controls(); |
| 79 |
$this->add_control('add_carousel_divider',['type' => Controls_Manager::DIVIDER,]); |
| 80 |
$this->TRAIT_register_carousel_settings_controls(); // Carousel settings |
| 81 |
|
| 82 |
$this->end_controls_section(); |
| 83 |
|
| 84 |
$this->TRAIT_register_navigation_controls(); // Navigation settings |
| 85 |
|
| 86 |
$this->start_controls_section( |
| 87 |
'section_style_review_items', |
| 88 |
[ |
| 89 |
'label' => esc_html__( 'Logo Carousel', 'uicore-elements' ), |
| 90 |
'tab' => Controls_Manager::TAB_STYLE, |
| 91 |
] |
| 92 |
); |
| 93 |
|
| 94 |
$this->start_controls_tabs( 'tabs_item_style' ); |
| 95 |
|
| 96 |
$this->start_controls_tab( |
| 97 |
'tab_item_normal', |
| 98 |
[ |
| 99 |
'label' => esc_html__( 'Normal', 'uicore-elements' ), |
| 100 |
] |
| 101 |
); |
| 102 |
$this->TRAIT_register_normal_item_style_controls(false); |
| 103 |
$this->TRAIT_register_logos_image_style_controls('normal'); |
| 104 |
$this->end_controls_tab(); |
| 105 |
|
| 106 |
$this->start_controls_tab( |
| 107 |
'tab_item_hover', |
| 108 |
[ |
| 109 |
'label' => esc_html__( 'Hover', 'uicore-elements' ), |
| 110 |
] |
| 111 |
); |
| 112 |
$this->TRAIT_register_hover_item_style_controls(false); |
| 113 |
$this->TRAIT_register_logos_image_style_controls('hover'); |
| 114 |
$this->end_controls_tab(); |
| 115 |
|
| 116 |
$this->start_controls_tab( |
| 117 |
'tab_item_active', |
| 118 |
[ |
| 119 |
'label' => esc_html__( 'Active', 'uicore-elements' ), |
| 120 |
] |
| 121 |
); |
| 122 |
$this->TRAIT_register_active_item_style_controls(false); |
| 123 |
$this->TRAIT_register_logos_image_style_controls('active'); |
| 124 |
$this->end_controls_tabs(); |
| 125 |
|
| 126 |
$this->end_controls_tabs(); // Necessary because register_testimonial_card_controls() OPENS but DON'T close start_controls_tabs() |
| 127 |
|
| 128 |
$this->end_controls_section(); |
| 129 |
|
| 130 |
$this->TRAIT_register_navigation_style_controls(); // Carousel Navigation Styles |
| 131 |
|
| 132 |
$this->start_controls_section( |
| 133 |
'section_style_animations', |
| 134 |
[ |
| 135 |
'label' => __('Animations', 'uicore-elements'), |
| 136 |
'tab' => Controls_Manager::TAB_STYLE, |
| 137 |
] |
| 138 |
); |
| 139 |
|
| 140 |
$this->TRAIT_register_entrance_animations_controls(); |
| 141 |
$this->TRAIT_register_hover_animation_control( |
| 142 |
'Item Hover Animation', |
| 143 |
[], |
| 144 |
['underline'] |
| 145 |
); |
| 146 |
$this->TRAIT_register_hover_animation_control( |
| 147 |
'Logo Hover Animation', |
| 148 |
[], |
| 149 |
['underline'] |
| 150 |
); |
| 151 |
|
| 152 |
$this->end_controls_section(); |
| 153 |
|
| 154 |
// Remove unused logo control |
| 155 |
$this->remove_control('height'); |
| 156 |
} |
| 157 |
public function render() |
| 158 |
{ |
| 159 |
?> |
| 160 |
<div class="ui-e-carousel swiper"> |
| 161 |
<div class='swiper-wrapper'> |
| 162 |
<?php $this->TRAIT_render_logo_item(); ?> |
| 163 |
</div> |
| 164 |
<?php $this->TRAIT_render_carousel_navigations(); ?> |
| 165 |
</div> |
| 166 |
<?php |
| 167 |
} |
| 168 |
} |
| 169 |
\Elementor\Plugin::instance()->widgets_manager->register(new LogoCarousel()); |