| 1 |
<?php |
| 2 |
namespace UiCoreElements; |
| 3 |
|
| 4 |
use Elementor\Controls_Manager; |
| 5 |
|
| 6 |
defined('ABSPATH') || exit(); |
| 7 |
|
| 8 |
/** |
| 9 |
* Gallery Slider |
| 10 |
* |
| 11 |
* Use Gallery Carousel as base |
| 12 |
* |
| 13 |
* @author Lucas Marini Falbo <lucas95@uicore.co> |
| 14 |
* @since 1.0.14 |
| 15 |
*/ |
| 16 |
|
| 17 |
class GallerySlider extends GalleryCarousel |
| 18 |
{ |
| 19 |
public function get_name() |
| 20 |
{ |
| 21 |
return 'uicore-gallery-slider'; |
| 22 |
} |
| 23 |
public function get_title() |
| 24 |
{ |
| 25 |
return esc_html__('Gallery Slider', 'uicore-elements'); |
| 26 |
} |
| 27 |
public function get_icon() |
| 28 |
{ |
| 29 |
return 'eicon-slides ui-e-widget'; |
| 30 |
} |
| 31 |
public function get_styles() |
| 32 |
{ |
| 33 |
$styles = parent::get_styles(); |
| 34 |
|
| 35 |
// replace 'gallery-carousel' for 'gallery-slider' |
| 36 |
unset($styles['gallery-carousel']); |
| 37 |
$styles[] = 'gallery-slider'; |
| 38 |
|
| 39 |
return $styles; |
| 40 |
} |
| 41 |
protected function register_controls() |
| 42 |
{ |
| 43 |
parent::register_controls(); // keep original controls |
| 44 |
|
| 45 |
// Add special animation slide |
| 46 |
$this->update_control( |
| 47 |
'animation_style', |
| 48 |
[ |
| 49 |
'default' => 'fade', |
| 50 |
'options' => [ |
| 51 |
'coverflow' => esc_html__('Coverflow', 'uicore-elements'), |
| 52 |
'fade' => esc_html__('Fade', 'uicore-elements'), |
| 53 |
'cards' => esc_html__('Cards', 'uicore-elements'), |
| 54 |
'flip' => esc_html__('Flip', 'uicore-elements'), |
| 55 |
'creative' => esc_html__('Creative', 'uicore-elements'), |
| 56 |
'stacked' => esc_html__('Stacked', 'uicore-elements'), |
| 57 |
] |
| 58 |
] |
| 59 |
); |
| 60 |
|
| 61 |
// Remove conditions from image height |
| 62 |
$this->update_responsive_control( |
| 63 |
'image_height', |
| 64 |
[ |
| 65 |
'conditions' => false, |
| 66 |
] |
| 67 |
); |
| 68 |
|
| 69 |
// Remove item entrance and hover animation |
| 70 |
$this->remove_control('animate_items'); |
| 71 |
$this->remove_control('item_hover_animation'); |
| 72 |
|
| 73 |
// Remove item active state styles |
| 74 |
$this->remove_control('tab_item_active'); |
| 75 |
$this->remove_control('item_active_background'); |
| 76 |
$this->remove_control('item_active_border_color'); |
| 77 |
$this->remove_control('item_active_box_shadow'); |
| 78 |
|
| 79 |
// Remove controls that are meant for carousel, not slide type widgets |
| 80 |
$this->remove_responsive_control('slides_per_view'); |
| 81 |
$this->remove_control('show_hidden'); |
| 82 |
$this->remove_control('fade_edges'); |
| 83 |
$this->remove_control('fade_edges_alert'); |
| 84 |
$this->remove_control('match_height'); |
| 85 |
$this->remove_control('carousel_gap'); |
| 86 |
$this->remove_control('main_image'); |
| 87 |
|
| 88 |
// Add vertical content alignment control |
| 89 |
$this->start_injection([ |
| 90 |
'of' => 'layout', |
| 91 |
'at' => 'after', |
| 92 |
]); |
| 93 |
|
| 94 |
$this->add_responsive_control( |
| 95 |
'content_v_alignment', |
| 96 |
[ |
| 97 |
'label' => __('Vertical Alignment', 'uicore-elements'), |
| 98 |
'type' => Controls_Manager::CHOOSE, |
| 99 |
'default' => 'start', |
| 100 |
'options' => [ |
| 101 |
'start' => [ |
| 102 |
'title' => __('Left', 'uicore-elements'), |
| 103 |
'icon' => 'eicon-align-start-v', |
| 104 |
], |
| 105 |
'center' => [ |
| 106 |
'title' => __('Center', 'uicore-elements'), |
| 107 |
'icon' => 'eicon-align-center-v', |
| 108 |
], |
| 109 |
'end' => [ |
| 110 |
'title' => __('Right', 'uicore-elements'), |
| 111 |
'icon' => 'eicon-align-end-v', |
| 112 |
], |
| 113 |
], |
| 114 |
'condition' => [ |
| 115 |
'layout' => 'ui-e-overlay' |
| 116 |
], |
| 117 |
'selectors' => [ |
| 118 |
'{{WRAPPER}} .ui-e-content' => 'justify-content: {{VALUE}};', |
| 119 |
] |
| 120 |
] |
| 121 |
); |
| 122 |
|
| 123 |
$this->end_injection(); |
| 124 |
} |
| 125 |
} |
| 126 |
\Elementor\Plugin::instance()->widgets_manager->register(new GallerySlider()); |