| 1 |
<?php |
| 2 |
namespace UiCoreElements; |
| 3 |
use Elementor\Plugin; |
| 4 |
|
| 5 |
defined('ABSPATH') || exit(); |
| 6 |
|
| 7 |
/** |
| 8 |
* Custom Slider |
| 9 |
* |
| 10 |
* @author Lucas Marini Falbo <lucas@uicore.co> |
| 11 |
* @since 1.0.7 |
| 12 |
*/ |
| 13 |
|
| 14 |
class CustomSlider extends CustomCarousel { |
| 15 |
|
| 16 |
public function get_name() |
| 17 |
{ |
| 18 |
return 'uicore-custom-slider'; |
| 19 |
} |
| 20 |
public function get_title() |
| 21 |
{ |
| 22 |
return esc_html__('Custom Slider', 'uicore-elements'); |
| 23 |
} |
| 24 |
public function get_icon() |
| 25 |
{ |
| 26 |
return 'eicon-slides ui-e-widget'; |
| 27 |
} |
| 28 |
public function get_categories() |
| 29 |
{ |
| 30 |
return ['uicore']; |
| 31 |
} |
| 32 |
public function get_keywords() |
| 33 |
{ |
| 34 |
return ['slide', 'carousel', 'nested']; |
| 35 |
} |
| 36 |
public function get_styles() |
| 37 |
{ |
| 38 |
$styles = [ |
| 39 |
'custom-slider', |
| 40 |
'carousel', |
| 41 |
'animation', // hover animations |
| 42 |
'entrance', // entrance basic style |
| 43 |
]; |
| 44 |
if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ |
| 45 |
$styles['e-animations'] = [ // entrance animations |
| 46 |
'external' => true, |
| 47 |
]; |
| 48 |
} |
| 49 |
return $styles; |
| 50 |
} |
| 51 |
|
| 52 |
protected function register_controls(bool $is_slider = false) |
| 53 |
{ |
| 54 |
|
| 55 |
parent::register_controls(true); // inherit original controls and enables slider height |
| 56 |
$this->TRAIT_update_slider_controls(); |
| 57 |
|
| 58 |
// Change default border radius to zero |
| 59 |
$this->update_control( |
| 60 |
'item_border_radius', |
| 61 |
[ |
| 62 |
'default' => [ |
| 63 |
'top' => 0, |
| 64 |
'right' => 0, |
| 65 |
'bottom' => 0, |
| 66 |
'left' => 0, |
| 67 |
'unit' => 'px', |
| 68 |
'isLinked' => true, |
| 69 |
], |
| 70 |
] |
| 71 |
); |
| 72 |
|
| 73 |
// Decrease default item padding |
| 74 |
$this->update_control( |
| 75 |
'item_padding', |
| 76 |
[ |
| 77 |
'default' => [ |
| 78 |
'top' => 25, |
| 79 |
'right' => 25, |
| 80 |
'bottom' => 25, |
| 81 |
'left' => 25, |
| 82 |
'unit' => 'px', |
| 83 |
'isLinked' => true, |
| 84 |
], |
| 85 |
] |
| 86 |
); |
| 87 |
} |
| 88 |
} |
| 89 |
\Elementor\Plugin::instance()->widgets_manager->register(new CustomSlider()); |