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