theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
6 months ago
heading-modern.php
6 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
6 months ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
video.php
289 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly. |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Elementor 'Video' widget. |
| 14 | * |
| 15 | * Elementor widget that displays an 'Video' with lightbox. |
| 16 | * |
| 17 | * @since 1.0.0 |
| 18 | */ |
| 19 | class Video extends Widget_Base { |
| 20 | |
| 21 | /** |
| 22 | * Get widget name. |
| 23 | * |
| 24 | * Retrieve 'Video' widget name. |
| 25 | * |
| 26 | * @since 1.0.0 |
| 27 | * @access public |
| 28 | * |
| 29 | * @return string Widget name. |
| 30 | */ |
| 31 | public function get_name() { |
| 32 | return 'aux_video'; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get widget title. |
| 37 | * |
| 38 | * Retrieve 'Video' widget title. |
| 39 | * |
| 40 | * @since 1.0.0 |
| 41 | * @access public |
| 42 | * |
| 43 | * @return string Widget title. |
| 44 | */ |
| 45 | public function get_title() { |
| 46 | return __('Video Player', 'auxin-elements' ); |
| 47 | } |
| 48 | |
| 49 | public function has_widget_inner_wrapper(): bool { |
| 50 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | /** |
| 55 | * Get widget icon. |
| 56 | * |
| 57 | * Retrieve 'Video' widget icon. |
| 58 | * |
| 59 | * @since 1.0.0 |
| 60 | * @access public |
| 61 | * |
| 62 | * @return string Widget icon. |
| 63 | */ |
| 64 | public function get_icon() { |
| 65 | return 'eicon-youtube auxin-badge'; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Get widget categories. |
| 70 | * |
| 71 | * Retrieve 'Video' widget icon. |
| 72 | * |
| 73 | * @since 1.0.0 |
| 74 | * @access public |
| 75 | * |
| 76 | * @return string Widget icon. |
| 77 | */ |
| 78 | public function get_categories() { |
| 79 | return array( 'auxin-core' ); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Register 'Video' widget controls. |
| 84 | * |
| 85 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 86 | * |
| 87 | * @since 1.0.0 |
| 88 | * @access protected |
| 89 | */ |
| 90 | protected function register_controls() { |
| 91 | |
| 92 | /*-----------------------------------------------------------------------------------*/ |
| 93 | /* audio_section |
| 94 | /*-----------------------------------------------------------------------------------*/ |
| 95 | |
| 96 | $this->start_controls_section( |
| 97 | 'audio_section', |
| 98 | array( |
| 99 | 'label' => __('Video', 'auxin-elements' ), |
| 100 | ) |
| 101 | ); |
| 102 | |
| 103 | $this->add_control( |
| 104 | 'type', |
| 105 | array( |
| 106 | 'label' => __('Video Type', 'auxin-elements'), |
| 107 | 'label_block' => true, |
| 108 | 'type' => Controls_Manager::SELECT, |
| 109 | 'default' => 'media', |
| 110 | 'options' => array( |
| 111 | 'media' => __( 'Media Library', 'auxin-elements' ), |
| 112 | 'link' => __( 'Youtube/Vimeo Link', 'auxin-elements' ) |
| 113 | ) |
| 114 | ) |
| 115 | ); |
| 116 | |
| 117 | $this->add_control( |
| 118 | 'media', |
| 119 | array( |
| 120 | 'label' => __('Video file','auxin-elements'), |
| 121 | 'type' => 'aux-media', |
| 122 | 'media_filter' => 'video', |
| 123 | 'condition' => array( |
| 124 | 'type' => array( 'media' ), |
| 125 | ) |
| 126 | ) |
| 127 | ); |
| 128 | |
| 129 | $this->add_control( |
| 130 | 'provider_link', |
| 131 | array( |
| 132 | 'label' => __('Youtube/Vimeo Link','auxin-elements'), |
| 133 | 'description' => __('Youtube, Vimeo or any video embed link.','auxin-elements'), |
| 134 | 'type' => Controls_Manager::URL, |
| 135 | 'show_external' => false, |
| 136 | 'placeholder' => 'https://vimeo.com/119777338', |
| 137 | 'condition' => [ |
| 138 | 'type' => 'link' |
| 139 | ], |
| 140 | 'dynamic' => [ |
| 141 | 'active' => true |
| 142 | ] |
| 143 | ) |
| 144 | ); |
| 145 | |
| 146 | $this->add_control( |
| 147 | 'autoplay', |
| 148 | array( |
| 149 | 'label' => __('AutoPlay','auxin-elements' ), |
| 150 | 'type' => Controls_Manager::SWITCHER, |
| 151 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 152 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 153 | 'return_value' => 'yes', |
| 154 | 'default' => 'no' |
| 155 | ) |
| 156 | ); |
| 157 | |
| 158 | $this->add_control( |
| 159 | 'loop', |
| 160 | array( |
| 161 | 'label' => __('Repeat the video','auxin-elements' ), |
| 162 | 'type' => Controls_Manager::SWITCHER, |
| 163 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 164 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 165 | 'return_value' => 'yes', |
| 166 | 'default' => 'yes' |
| 167 | ) |
| 168 | ); |
| 169 | |
| 170 | $this->add_control( |
| 171 | 'poster', |
| 172 | array( |
| 173 | 'label' => __('Video poster','auxin-elements'), |
| 174 | 'description' => __('An image that represents the video content.','auxin-elements'), |
| 175 | 'type' => Controls_Manager::MEDIA |
| 176 | ) |
| 177 | ); |
| 178 | |
| 179 | $this->end_controls_section(); |
| 180 | |
| 181 | /*-----------------------------------------------------------------------------------*/ |
| 182 | /* skin_section |
| 183 | /*-----------------------------------------------------------------------------------*/ |
| 184 | |
| 185 | $this->start_controls_section( |
| 186 | 'style_section', |
| 187 | array( |
| 188 | 'label' => __('Style', 'auxin-elements' ), |
| 189 | 'tab' => Controls_Manager::TAB_STYLE, |
| 190 | ) |
| 191 | ); |
| 192 | |
| 193 | $this->add_control( |
| 194 | 'width', |
| 195 | array( |
| 196 | 'label' => __('Width','auxin-elements'), |
| 197 | 'description' => __('Width size of video in pixel.','auxin-elements'), |
| 198 | 'type' => Controls_Manager::SLIDER, |
| 199 | 'size_units' => array('px'), |
| 200 | 'range' => array( |
| 201 | 'px' => array( |
| 202 | 'min' => 1, |
| 203 | 'max' => 1600, |
| 204 | 'step' => 1 |
| 205 | ) |
| 206 | ) |
| 207 | ) |
| 208 | ); |
| 209 | |
| 210 | |
| 211 | $this->add_control( |
| 212 | 'height', |
| 213 | array( |
| 214 | 'label' => __('Height','auxin-elements'), |
| 215 | 'description' => __('Height size of video in pixel.','auxin-elements'), |
| 216 | 'type' => Controls_Manager::SLIDER, |
| 217 | 'size_units' => array('px'), |
| 218 | 'range' => array( |
| 219 | 'px' => array( |
| 220 | 'min' => 1, |
| 221 | 'max' => 1600, |
| 222 | 'step' => 1 |
| 223 | ) |
| 224 | ) |
| 225 | ) |
| 226 | ); |
| 227 | |
| 228 | $this->add_control( |
| 229 | 'skin', |
| 230 | array( |
| 231 | 'label' => __('Player skin','auxin-elements'), |
| 232 | 'description' => __('Specifies skin for the player.','auxin-elements'), |
| 233 | 'type' => 'aux-visual-select', |
| 234 | 'options' => array( |
| 235 | 'dark' => array( |
| 236 | 'label' => __('Dark', 'auxin-elements'), |
| 237 | 'image' => AUXIN_URL . 'images/visual-select/audio-player-dark.svg' |
| 238 | ), |
| 239 | 'light' => array( |
| 240 | 'label' => __('Light', 'auxin-elements'), |
| 241 | 'image' => AUXIN_URL . 'images/visual-select/audio-player-light.svg' |
| 242 | ) |
| 243 | ), |
| 244 | 'default' => 'dark' |
| 245 | ) |
| 246 | ); |
| 247 | |
| 248 | $this->end_controls_section(); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Render image box widget output on the frontend. |
| 253 | * |
| 254 | * Written in PHP and used to generate the final HTML. |
| 255 | * |
| 256 | * @since 1.0.0 |
| 257 | * @access protected |
| 258 | */ |
| 259 | protected function render() { |
| 260 | |
| 261 | $settings = $this->get_settings_for_display(); |
| 262 | $src = ''; |
| 263 | |
| 264 | if( 'media' == $settings['type'] ){ |
| 265 | $src = $settings['media']['id']; |
| 266 | } elseif( 'link' == $settings['type'] ){ |
| 267 | if ( ! $src = $settings['provider_link']['url'] ){ |
| 268 | $src = 'https://vimeo.com/119777338'; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | $args = array( |
| 273 | 'src' => $src, |
| 274 | 'url' => '', |
| 275 | 'autoplay' => $settings['autoplay'], |
| 276 | 'loop' => $settings['loop'], |
| 277 | 'poster' => $settings['poster']['id'], |
| 278 | |
| 279 | 'width' => $settings['width']['size'], |
| 280 | 'height' => $settings['height']['size'], |
| 281 | 'skin' => $settings['skin'] |
| 282 | ); |
| 283 | |
| 284 | // get the shortcode base blog page |
| 285 | echo auxin_widget_video_callback( $args ); |
| 286 | } |
| 287 | |
| 288 | } |
| 289 |