templates
1 year ago
Accordion.php
1 year ago
Alerts_Box.php
1 year ago
Animated_Heading.php
1 year ago
Before_after.php
1 year ago
Blog_Grid.php
1 year ago
Buttons.php
1 year ago
Cheat_sheet.php
1 year ago
Counter.php
1 year ago
Fullscreen_Slider.php
1 year ago
Icon_box.php
1 year ago
Instagram.php
1 year ago
Integrations.php
1 year ago
List_Item.php
1 year ago
Pricing_Table_Switcher.php
1 year ago
Pricing_Table_Tabs.php
1 year ago
Tabs.php
1 year ago
Team_Carousel.php
1 year ago
Testimonial.php
1 year ago
Timeline.php
1 year ago
Video_Playlist.php
1 year ago
Video_Popup.php
1 year ago
Video_Popup.php
435 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Group_Control_Background; |
| 9 | use Elementor\Group_Control_Border; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | use Elementor\Widget_Base; |
| 12 | use Elementor\Controls_Manager; |
| 13 | use Elementor\Repeater; |
| 14 | |
| 15 | // Exit if accessed directly |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Class Team |
| 22 | * @package spider\Widgets |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class Video_Popup extends Widget_Base { |
| 26 | |
| 27 | public function get_name() { |
| 28 | return 'docy_video_popup'; // ID of the widget (Don't change this name) |
| 29 | } |
| 30 | |
| 31 | public function get_title() { |
| 32 | return esc_html__( 'Video Popup', 'spider-elements' ); |
| 33 | } |
| 34 | |
| 35 | public function get_icon() { |
| 36 | return 'eicon-play spel-icon'; |
| 37 | } |
| 38 | |
| 39 | public function get_keywords() { |
| 40 | return [ 'spider', 'video', 'video-popup', ]; |
| 41 | } |
| 42 | |
| 43 | public function get_categories() { |
| 44 | return [ 'spider-elements' ]; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Name: get_style_depends() |
| 49 | * Desc: Register the required CSS dependencies for the frontend. |
| 50 | */ |
| 51 | public function get_style_depends() { |
| 52 | return [ 'elegant-icon', 'fancybox', 'spel-main' ]; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Name: get_script_depends() |
| 57 | * Desc: Register the required JS dependencies for the frontend. |
| 58 | */ |
| 59 | public function get_script_depends() { |
| 60 | return [ 'spel-el-widgets', 'fancybox', 'slick' ]; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * Name: register_controls() |
| 66 | * Desc: Register controls for these widgets |
| 67 | * Params: no params |
| 68 | * Return: @void |
| 69 | * Since: @1.0.0 |
| 70 | * Package: @spider-elements |
| 71 | * Author: spider-themes |
| 72 | */ |
| 73 | protected function register_controls() { |
| 74 | $this->elementor_content_control(); |
| 75 | $this->video_style_control(); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /** |
| 80 | * Name: elementor_content_control() |
| 81 | * Desc: Register the Content Tab output on the Elementor editor. |
| 82 | * Params: no params |
| 83 | * Return: @void |
| 84 | * Since: @1.0.0 |
| 85 | * Package: @spider-elements |
| 86 | * Author: spider-themes |
| 87 | */ |
| 88 | |
| 89 | public function elementor_content_control() { |
| 90 | |
| 91 | //==================== Select Preset Skin ====================// |
| 92 | $this->start_controls_section( |
| 93 | 'video_popup_sec', [ |
| 94 | 'label' => esc_html__( 'Preset Skin', 'spider-elements' ), |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | $this->add_control( |
| 99 | 'style', [ |
| 100 | 'label' => esc_html__( 'Skin', 'spider-elements' ), |
| 101 | 'type' => Controls_Manager::CHOOSE, |
| 102 | 'options' => [ |
| 103 | '1' => [ |
| 104 | 'title' => esc_html__( 'Style 01', 'spider-elements' ), |
| 105 | 'icon' => 'video-popup-1', |
| 106 | ], |
| 107 | '2' => [ |
| 108 | 'title' => esc_html__( 'Style 02', 'spider-elements' ), |
| 109 | 'icon' => 'video-popup-2', |
| 110 | ], |
| 111 | ], |
| 112 | 'toggle' => false, |
| 113 | 'default' => '1', |
| 114 | ] |
| 115 | ); |
| 116 | |
| 117 | $this->end_controls_section(); // End Preset Skin |
| 118 | |
| 119 | |
| 120 | // ============================ Video Popup Content ===========================// |
| 121 | $this->start_controls_section( |
| 122 | 'video_sec', [ |
| 123 | 'label' => esc_html__( 'Video', 'spider-elements' ), |
| 124 | ] |
| 125 | ); |
| 126 | |
| 127 | $this->add_control( |
| 128 | 'video_url', [ |
| 129 | 'label' => esc_html__( 'Video URL', 'spider-elements' ), |
| 130 | 'type' => Controls_Manager::TEXT, |
| 131 | 'label_block' => true, |
| 132 | 'default' => '#' |
| 133 | ] |
| 134 | ); |
| 135 | |
| 136 | $this->add_control( |
| 137 | 'video_icon', [ |
| 138 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 139 | 'type' => Controls_Manager::ICONS, |
| 140 | 'default' => [ |
| 141 | 'value' => 'fas fa-play', |
| 142 | 'library' => 'solid', |
| 143 | ], |
| 144 | ] |
| 145 | ); |
| 146 | |
| 147 | $this->end_controls_section(); // End Video Popup Content |
| 148 | } |
| 149 | |
| 150 | |
| 151 | /** |
| 152 | * Name: elementor_style_control() |
| 153 | * Desc: Register the Style Tab output on the Elementor editor. |
| 154 | * Params: no params |
| 155 | * Return: @void |
| 156 | * Since: @1.0.0 |
| 157 | * Package: @spider-elements |
| 158 | * Author: spider-themes |
| 159 | */ |
| 160 | public function video_style_control() { |
| 161 | |
| 162 | //===================== Icon Style ============================// |
| 163 | $this->start_controls_section( |
| 164 | 'style_icon', [ |
| 165 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 166 | 'tab' => Controls_Manager::TAB_STYLE, |
| 167 | 'condition' => [ |
| 168 | 'style' => [ '1', '2' ] |
| 169 | ], |
| 170 | ] |
| 171 | ); |
| 172 | |
| 173 | |
| 174 | $this->start_controls_tabs( |
| 175 | 'icon_style_tabs' |
| 176 | ); |
| 177 | |
| 178 | |
| 179 | // Normal tabs |
| 180 | $this->start_controls_tab( |
| 181 | 'icon_normal_tabs', [ |
| 182 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 183 | 'condition' => [ |
| 184 | 'style' => [ '1', '2' ] |
| 185 | ], |
| 186 | ] |
| 187 | ); |
| 188 | |
| 189 | $this->add_control( |
| 190 | 'icon_font_color', |
| 191 | [ |
| 192 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 193 | 'type' => Controls_Manager::COLOR, |
| 194 | 'selectors' => [ |
| 195 | '{{WRAPPER}} .video-icon' => 'color: {{VALUE}}', |
| 196 | '{{WRAPPER}} .video2-icon' => 'color: {{VALUE}}', |
| 197 | ], |
| 198 | 'condition' => [ |
| 199 | 'style' => [ '1', '2' ] |
| 200 | ], |
| 201 | ] |
| 202 | ); |
| 203 | |
| 204 | $this->add_control( |
| 205 | 'icon_bg_color', |
| 206 | [ |
| 207 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 208 | 'type' => Controls_Manager::COLOR, |
| 209 | 'selectors' => [ |
| 210 | '{{WRAPPER}} .video-icon' => 'background-color: {{VALUE}}', |
| 211 | '{{WRAPPER}} .video2-icon' => 'background-color: {{VALUE}}', |
| 212 | ], |
| 213 | 'condition' => [ |
| 214 | 'style' => [ '1', '2' ] |
| 215 | ], |
| 216 | ] |
| 217 | ); |
| 218 | |
| 219 | $this->end_controls_tab(); |
| 220 | |
| 221 | // Hover tabs |
| 222 | $this->start_controls_tab( |
| 223 | 'icon_hover_tabs', [ |
| 224 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 225 | 'condition' => [ |
| 226 | 'style' => [ '1', '2' ] |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->add_control( |
| 232 | 'icon_hover_font_color', |
| 233 | [ |
| 234 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 235 | 'type' => Controls_Manager::COLOR, |
| 236 | 'selectors' => [ |
| 237 | '{{WRAPPER}} .video-icon:hover' => 'color: {{VALUE}}', |
| 238 | '{{WRAPPER}} .video2-icon:hover' => 'color: {{VALUE}}', |
| 239 | ], |
| 240 | 'condition' => [ |
| 241 | 'style' => [ '1', '2' ] |
| 242 | ], |
| 243 | ] |
| 244 | ); |
| 245 | |
| 246 | $this->add_control( |
| 247 | 'icon_hover_bg_color', |
| 248 | [ |
| 249 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 250 | 'type' => Controls_Manager::COLOR, |
| 251 | 'selectors' => [ |
| 252 | '{{WRAPPER}} .video-icon:hover' => 'background-color: {{VALUE}}', |
| 253 | '{{WRAPPER}} .video2-icon:hover' => 'background-color: {{VALUE}}', |
| 254 | ], |
| 255 | 'condition' => [ |
| 256 | 'style' => [ '1', '2' ] |
| 257 | ], |
| 258 | ] |
| 259 | ); |
| 260 | |
| 261 | $this->add_control( |
| 262 | 'icon_hover_border_color', |
| 263 | [ |
| 264 | 'label' => esc_html__( 'Border Color', 'spider-elements' ), |
| 265 | 'type' => Controls_Manager::COLOR, |
| 266 | 'selectors' => [ |
| 267 | '{{WRAPPER}} .video-icon:hover' => 'border-color: {{VALUE}}', |
| 268 | ], |
| 269 | 'condition' => [ |
| 270 | 'style' => [ '1' ], |
| 271 | 'style!' => [ '2' ] |
| 272 | ] |
| 273 | ] |
| 274 | ); |
| 275 | |
| 276 | $this->end_controls_tab(); |
| 277 | $this->end_controls_tabs(); // End Tabs |
| 278 | |
| 279 | $this->add_control( |
| 280 | 'icon_style_divider', [ |
| 281 | 'type' => Controls_Manager::DIVIDER, |
| 282 | ] |
| 283 | ); |
| 284 | |
| 285 | $this->add_group_control( |
| 286 | Group_Control_Border::get_type(), |
| 287 | [ |
| 288 | 'name' => 'icon_border', |
| 289 | 'label' => esc_html__( 'Border', 'spider-elements' ), |
| 290 | 'selector' => '{{WRAPPER}} .video-icon', |
| 291 | 'condition' => [ |
| 292 | 'style' => [ '1' ], |
| 293 | 'style!' => [ '2'] |
| 294 | ] |
| 295 | ] |
| 296 | ); |
| 297 | |
| 298 | $this->add_responsive_control( |
| 299 | 'icon_border_radius', |
| 300 | [ |
| 301 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 302 | 'type' => Controls_Manager::DIMENSIONS, |
| 303 | 'size_units' => [ 'px', '%', 'em' ], |
| 304 | 'selectors' => [ |
| 305 | '{{WRAPPER}} .video-icon, .play-button a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 306 | ], |
| 307 | 'condition' => [ |
| 308 | 'style' => [ '1' ], |
| 309 | 'style!' => [ '2'] |
| 310 | ] |
| 311 | ] |
| 312 | ); |
| 313 | |
| 314 | $this->add_responsive_control( |
| 315 | 'icon_size', |
| 316 | [ |
| 317 | 'label' => esc_html__( 'Size', 'spider-elements' ), |
| 318 | 'type' => Controls_Manager::SLIDER, |
| 319 | 'size_units' => [ 'px', '%' ], |
| 320 | 'range' => [ |
| 321 | 'px' => [ |
| 322 | 'min' => 0, |
| 323 | 'max' => 100, |
| 324 | ], |
| 325 | '%' => [ |
| 326 | 'min' => 0, |
| 327 | 'max' => 100, |
| 328 | ], |
| 329 | ], |
| 330 | 'default' => [ |
| 331 | 'unit' => 'px', |
| 332 | ], |
| 333 | 'selectors' => [ |
| 334 | '{{WRAPPER}} .video-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 335 | '{{WRAPPER}} .video2-icon ' => 'font-size: {{SIZE}}{{UNIT}};', |
| 336 | |
| 337 | ], |
| 338 | ] |
| 339 | ); |
| 340 | |
| 341 | $this->add_control( |
| 342 | 'popup_shadow', |
| 343 | [ |
| 344 | 'label' => esc_html__( 'Popup Shadow', 'spider-elements' ), |
| 345 | 'type' => Controls_Manager::COLOR, |
| 346 | 'selectors' => [ |
| 347 | '{{WRAPPER}} .video2-icon::after ' => 'background: {{VALUE}}', |
| 348 | ], |
| 349 | 'separator' => 'after', |
| 350 | 'condition' => [ |
| 351 | 'style' => [ '2' ], |
| 352 | 'style!' => [ '1'] |
| 353 | ] |
| 354 | ] |
| 355 | ); |
| 356 | |
| 357 | $this->add_responsive_control( |
| 358 | 'icon_bg_width', [ |
| 359 | 'label' => esc_html__( 'Video Popup Width', 'spider-elements' ), |
| 360 | 'type' => Controls_Manager::SLIDER, |
| 361 | 'size_units' => [ 'px', '%' ], |
| 362 | 'range' => [ |
| 363 | 'px' => [ |
| 364 | 'min' => 0, |
| 365 | 'max' => 1000, |
| 366 | ], |
| 367 | '%' => [ |
| 368 | 'min' => 0, |
| 369 | 'max' => 100, |
| 370 | ], |
| 371 | ], |
| 372 | 'default' => [ |
| 373 | 'unit' => 'px', |
| 374 | 'size' => '90', |
| 375 | ], |
| 376 | 'selectors' => [ |
| 377 | '{{WRAPPER}} .video-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 378 | '{{WRAPPER}} .video2-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 379 | '{{WRAPPER}} .video2-icon::before' => 'width: calc({{SIZE}}{{UNIT}} + 30px); height: calc({{SIZE}}{{UNIT}} + 30px); top: -15px; left: -15px;', |
| 380 | '{{WRAPPER}} .video2-icon::after' => 'width: calc({{SIZE}}{{UNIT}} + 60px); height: calc({{SIZE}}{{UNIT}} + 60px); top: -30px; left: -30px;', |
| 381 | ], |
| 382 | 'condition' => [ |
| 383 | 'style' => [ '1', '2' ] |
| 384 | ], |
| 385 | ] |
| 386 | ); |
| 387 | |
| 388 | // Wave switcher |
| 389 | $this->add_control( |
| 390 | 'enable_wave_regular', [ |
| 391 | 'label' => esc_html__( 'Enable Wave on Regular', 'spider-elements' ), |
| 392 | 'type' => Controls_Manager::SWITCHER, |
| 393 | 'default' => 'no', |
| 394 | 'condition' => [ |
| 395 | 'style' => [ '1' ], |
| 396 | 'style!' => [ '2'] |
| 397 | ] |
| 398 | ] |
| 399 | ); |
| 400 | |
| 401 | // Wave effect Hover switcher |
| 402 | $this->add_control( |
| 403 | 'enable_wave_hover', [ |
| 404 | 'label' => esc_html__( 'Enable Wave on Hover', 'spider-elements' ), |
| 405 | 'type' => Controls_Manager::SWITCHER, |
| 406 | 'default' => 'no', |
| 407 | 'condition' => [ |
| 408 | 'style' => [ '1' ], |
| 409 | 'style!' => [ '2'] |
| 410 | ] |
| 411 | ] |
| 412 | ); |
| 413 | |
| 414 | |
| 415 | $this->end_controls_section(); |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Name: elementor_render() |
| 420 | * Desc: Render the widget output on the frontend. |
| 421 | * Params: no params |
| 422 | * Return: @void |
| 423 | * Since: @1.0.0 |
| 424 | * Package: @spider-elements |
| 425 | * Author: spider-themes |
| 426 | */ |
| 427 | protected function render() { |
| 428 | $settings = $this->get_settings_for_display(); |
| 429 | extract( $settings ); //extract all settings array to variables converted to name of a key |
| 430 | |
| 431 | //================= Template Parts =================// |
| 432 | include "templates/video-popup/video-popup-{$settings['style']}.php"; |
| 433 | } |
| 434 | } |
| 435 |