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