PluginProbe
Enter Addons – Ultimate Template Builder for Elementor / trunk
Enter Addons – Ultimate Template Builder for Elementor vtrunk
trunk 2.2.10 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4
enteraddons / widgets / video-button / Video_Button.php

Video_Button.php in Enter Addons – Ultimate Template Builder for Elementor trunk, at widgets/video-button/Video_Button.php

634 lines 23.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Enteraddons\Widgets\Video_Button;
3
4 use Elementor\Widget_Base;
5 use Elementor\Controls_Manager;
6 use Elementor\Scheme_Color;
7 use Elementor\Scheme_Typography;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Border;
12
13 // Exit if accessed directly
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 *
20 * Enteraddons elementor Video Button widget.
21 *
22 * @since 1.0
23 */
24 class Video_Button extends Widget_Base {
25
26 public function get_name() {
27 return 'enteraddons-video-button';
28 }
29
30 public function get_title() {
31 return esc_html__( 'Video Button', 'enteraddons' );
32 }
33
34 public function get_icon() {
35 return 'entera entera-video-button';
36 }
37
38 public function get_categories() {
39 return ['enteraddons-elements-category'];
40 }
41
42 protected function register_controls() {
43
44 // ---------------------------------------- Video Button content ------------------------------
45 $this->start_controls_section(
46 'enteraddons_video_button_content_settings',
47 [
48 'label' => esc_html__( 'Video Button Content', 'enteraddons' ),
49 ]
50 );
51
52 $this->add_control(
53 'thumb_image',
54 [
55 'label' => esc_html__( 'Thumb Image', 'enteraddons' ),
56 'type' => \Elementor\Controls_Manager::MEDIA,
57 'dynamic' => [
58 'active' => true,
59 ],
60 'default' => [
61 'url' => \Elementor\Utils::get_placeholder_image_src(),
62 ],
63 ]
64 );
65 $this->add_control(
66 'btn_icon',
67 [
68 'label' => esc_html__( 'Button Icon', 'enteraddons' ),
69 'type' => \Elementor\Controls_Manager::ICONS,
70 'default' => [
71 'value' => 'fas fa-play',
72 'library' => 'solid',
73 ],
74 ]
75 );
76 $this->add_control(
77 'overly_active',
78 [
79 'label' => esc_html__( 'Active Overlay', 'enteraddons' ),
80 'type' => \Elementor\Controls_Manager::SWITCHER,
81 'label_on' => esc_html__( 'Yes', 'enteraddons' ),
82 'label_off' => esc_html__( 'NO', 'enteraddons' ),
83 'return_value' => 'yes',
84 'default' => 'yes',
85 ]
86 );
87 $this->add_control(
88 'circle_animation_active',
89 [
90 'label' => esc_html__( 'Active Circle Animation', 'enteraddons' ),
91 'type' => \Elementor\Controls_Manager::SWITCHER,
92 'label_on' => esc_html__( 'Yes', 'enteraddons' ),
93 'label_off' => esc_html__( 'NO', 'enteraddons' ),
94 'return_value' => 'yes',
95 'default' => 'yes',
96 ]
97 );
98 $this->add_control(
99 'video_url',
100 [
101 'label' => esc_html__( 'Video Url', 'enteraddons' ),
102 'label_block' => true,
103 'type' => \Elementor\Controls_Manager::TEXT,
104 'dynamic' => [
105 'active' => true,
106 ]
107 ]
108 );
109 $this->end_controls_section(); // End content
110
111 /**
112 * Style Tab
113 * ------------------------------ Content Wrapper Style ------------------------------
114 *
115 */
116 $this->start_controls_section(
117 'enteraddons_video_button_wrapper_style_settings', [
118 'label' => esc_html__( 'Wrapper Settings', 'enteraddons' ),
119 'tab' => Controls_Manager::TAB_STYLE,
120 ]
121 );
122 $this->add_responsive_control(
123 'video_button_wrap_width',
124 [
125 'label' => esc_html__( 'Wrapper Width', 'enteraddons' ),
126 'type' => Controls_Manager::SLIDER,
127 'size_units' => [ 'px', '%' ],
128 'range' => [
129 'px' => [
130 'min' => 0,
131 'max' => 1000,
132 'step' => 1,
133 ],
134 '%' => [
135 'min' => 0,
136 'max' => 100,
137 ],
138 ],
139 'default' => [
140 'unit' => '%',
141 'size' => '',
142 ],
143 'selectors' => [
144 '{{WRAPPER}} .enteraddons-video-wrap' => 'width: {{SIZE}}{{UNIT}};',
145 ],
146 ]
147 );
148 $this->add_responsive_control(
149 'video_button_wrap_height',
150 [
151 'label' => esc_html__( 'Wrapper Height', 'enteraddons' ),
152 'type' => Controls_Manager::SLIDER,
153 'size_units' => [ 'px', '%' ],
154 'range' => [
155 'px' => [
156 'min' => 0,
157 'max' => 1000,
158 'step' => 1,
159 ],
160 '%' => [
161 'min' => 0,
162 'max' => 100,
163 ],
164 ],
165 'default' => [
166 'unit' => '%',
167 'size' => '',
168 ],
169 'selectors' => [
170 '{{WRAPPER}} .enteraddons-video-wrap' => 'height: {{SIZE}}{{UNIT}};',
171 ],
172 ]
173 );
174 $this->add_responsive_control(
175 'video_button_wrap_margin',
176 [
177 'label' => esc_html__( 'Margin', 'enteraddons' ),
178 'type' => Controls_Manager::DIMENSIONS,
179 'devices' => [ 'desktop', 'tablet', 'mobile' ],
180 'size_units' => [ 'px', '%', 'em' ],
181 'selectors' => [
182 '{{WRAPPER}} .enteraddons-video-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
183 ],
184 ]
185 );
186 $this->add_responsive_control(
187 'video_button_wrap_padding',
188 [
189 'label' => esc_html__( 'Padding', 'enteraddons' ),
190 'type' => Controls_Manager::DIMENSIONS,
191 'devices' => [ 'desktop', 'tablet', 'mobile' ],
192 'size_units' => [ 'px', '%', 'em' ],
193 'selectors' => [
194 '{{WRAPPER}} .enteraddons-video-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
195 ],
196 ]
197 );
198 $this->add_group_control(
199 \Elementor\Group_Control_Border::get_type(),
200 [
201 'name' => 'video_button_border',
202 'label' => esc_html__( 'Border', 'enteraddons' ),
203 'selector' => '{{WRAPPER}} .enteraddons-video-wrap',
204 ]
205 );
206 $this->add_responsive_control(
207 'video_button_wrap_radius',
208 [
209 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
210 'type' => Controls_Manager::DIMENSIONS,
211 'devices' => [ 'desktop', 'tablet', 'mobile' ],
212 'size_units' => [ 'px', '%', 'em' ],
213 'selectors' => [
214 '{{WRAPPER}} .enteraddons-video-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
215 ],
216 ]
217 );
218 $this->add_group_control(
219 \Elementor\Group_Control_Box_Shadow::get_type(),
220 [
221 'name' => 'video_button_wrap_shadow',
222 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
223 'selector' => '{{WRAPPER}} .enteraddons-video-wrap',
224 ]
225 );
226 $this->add_group_control(
227 \Elementor\Group_Control_Background::get_type(),
228 [
229 'name' => 'video_button_wrap_background',
230 'label' => esc_html__( 'Background', 'enteraddons' ),
231 'types' => [ 'classic', 'gradient' ],
232 'selector' => '{{WRAPPER}} .enteraddons-video-wrap',
233 ]
234 );
235 $this->add_control(
236 'overlay_background_heading',
237 [
238 'label' => esc_html__( 'Overlay Background', 'enteraddons' ),
239 'type' => \Elementor\Controls_Manager::HEADING,
240 'separator' => 'before',
241 ]
242 );
243 $this->add_group_control(
244 \Elementor\Group_Control_Background::get_type(),
245 [
246 'name' => 'video_button_overlay_background',
247 'label' => esc_html__( 'Background', 'enteraddons' ),
248 'types' => [ 'classic', 'gradient' ],
249 'selector' => '{{WRAPPER}} .enteraddons-video-wrap.video-overlay:after',
250 ]
251 );
252 $this->end_controls_section();
253
254 //------------------------------ Image Style ------------------------------
255 $this->start_controls_section(
256 'enteraddons_video_button_img_style', [
257 'label' => esc_html__( 'Image Style', 'enteraddons' ),
258 'tab' => Controls_Manager::TAB_STYLE,
259 ]
260 );
261 $this->add_responsive_control(
262 'img_width',
263 [
264 'label' => esc_html__( 'Image Width', 'enteraddons' ),
265 'type' => Controls_Manager::SLIDER,
266 'size_units' => [ 'px', '%' ],
267 'range' => [
268 'px' => [
269 'min' => 0,
270 'max' => 1000,
271 'step' => 1,
272 ],
273 '%' => [
274 'min' => 0,
275 'max' => 100,
276 ],
277 ],
278 'default' => [
279 'unit' => '%',
280 'size' => '',
281 ],
282 'selectors' => [
283 '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img' => 'width: {{SIZE}}{{UNIT}};',
284 ],
285 ]
286 );
287 $this->add_responsive_control(
288 'img_height',
289 [
290 'label' => esc_html__( 'Image Height', 'enteraddons' ),
291 'type' => Controls_Manager::SLIDER,
292 'size_units' => [ 'px', '%' ],
293 'range' => [
294 'px' => [
295 'min' => 0,
296 'max' => 1000,
297 'step' => 1,
298 ],
299 '%' => [
300 'min' => 0,
301 'max' => 100,
302 ],
303 ],
304 'default' => [
305 'unit' => '%',
306 'size' => '',
307 ],
308 'selectors' => [
309 '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img' => 'height: {{SIZE}}{{UNIT}};',
310 ],
311 ]
312 );
313 $this->add_responsive_control(
314 'video_button_img_margin',
315 [
316 'label' => esc_html__( 'Margin', 'enteraddons' ),
317 'type' => Controls_Manager::DIMENSIONS,
318 'devices' => [ 'desktop', 'tablet', 'mobile' ],
319 'size_units' => [ 'px', '%', 'em' ],
320 'selectors' => [
321 '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
322 ],
323 ]
324 );
325 $this->add_responsive_control(
326 'video_button_img_padding',
327 [
328 'label' => esc_html__( 'Padding', 'enteraddons' ),
329 'type' => Controls_Manager::DIMENSIONS,
330 'devices' => [ 'desktop', 'tablet', 'mobile' ],
331 'size_units' => [ 'px', '%', 'em' ],
332 'selectors' => [
333 '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
334 ],
335 ]
336 );
337 $this->add_group_control(
338 \Elementor\Group_Control_Border::get_type(),
339 [
340 'name' => 'video_button_img_border',
341 'label' => esc_html__( 'Border', 'enteraddons' ),
342 'selector' => '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img,{{WRAPPER}} .enteraddons-video-wrap.video-overlay:after',
343 ]
344 );
345 $this->add_responsive_control(
346 'video_button_img_radius',
347 [
348 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
349 'type' => Controls_Manager::DIMENSIONS,
350 'devices' => [ 'desktop', 'tablet', 'mobile' ],
351 'size_units' => [ 'px', '%', 'em' ],
352 'selectors' => [
353 '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
354 '{{WRAPPER}} .enteraddons-video-wrap.video-overlay:after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
355 ],
356 ]
357 );
358 $this->add_group_control(
359 \Elementor\Group_Control_Box_Shadow::get_type(),
360 [
361 'name' => 'video_button_img_shadow',
362 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
363 'selector' => '{{WRAPPER}} .enteraddons-video-wrap .video-thumb-img',
364 ]
365 );
366
367 $this->end_controls_section();
368
369 //------------------------------ Button Style ------------------------------
370 $this->start_controls_section(
371 'enteraddons_video_button_play_btn_style', [
372 'label' => esc_html__( 'Play Button Style', 'enteraddons' ),
373 'tab' => Controls_Manager::TAB_STYLE,
374 ]
375 );
376
377 //
378 $this->add_control(
379 'play_btn_position',
380 [
381 'label' => esc_html__( 'Position Type', 'enteraddons' ),
382 'type' => \Elementor\Controls_Manager::SELECT,
383 'default' => '',
384 'options' => [
385 '' => esc_html__( 'Relative', 'enteraddons' ),
386 'absolute' => esc_html__( 'Absolute', 'enteraddons' ),
387 ],
388 'selectors' => [
389 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'position: {{VALUE}};',
390 ],
391
392 ]
393 );
394 $this->add_responsive_control(
395 'play_btn_top_bottom_position',
396 [
397 'label' => esc_html__( 'Top, Bottom Position', 'enteraddons' ),
398 'type' => Controls_Manager::SLIDER,
399 'condition' => [ 'play_btn_position' => 'absolute' ],
400 'size_units' => [ 'px', '%' ],
401 'range' => [
402 'px' => [
403 'min' => 0,
404 'max' => 1000,
405 'step' => 1,
406 ],
407 '%' => [
408 'min' => 0,
409 'max' => 100,
410 ],
411 ],
412 'default' => [
413 'unit' => 'px',
414 'size' => '90',
415 ],
416 'selectors' => [
417 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'top: {{SIZE}}{{UNIT}};'
418 ],
419 ]
420 );
421
422 $this->add_responsive_control(
423 'play_btn_left_right_position',
424 [
425 'label' => esc_html__( 'Left, Right Position', 'enteraddons' ),
426 'type' => Controls_Manager::SLIDER,
427 'condition' => [ 'play_btn_position' => 'absolute' ],
428 'size_units' => [ 'px', '%' ],
429 'range' => [
430 'px' => [
431 'min' => 0,
432 'max' => 1000,
433 'step' => 1,
434 ],
435 '%' => [
436 'min' => 0,
437 'max' => 100,
438 ],
439 ],
440 'default' => [
441 'unit' => 'px',
442 'size' => '90',
443 ],
444 'selectors' => [
445 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'left: {{SIZE}}{{UNIT}};'
446 ],
447 ]
448 );
449
450 $this->add_control(
451 'position_hr',
452 [
453 'type' => \Elementor\Controls_Manager::DIVIDER,
454 'condition' => [ 'play_btn_position' => 'absolute' ]
455 ]
456 );
457 //
458 $this->add_responsive_control(
459 'play_btn_width',
460 [
461 'label' => esc_html__( 'Button Width', 'enteraddons' ),
462 'type' => Controls_Manager::SLIDER,
463 'size_units' => [ 'px', '%' ],
464 'range' => [
465 'px' => [
466 'min' => 0,
467 'max' => 1000,
468 'step' => 1,
469 ],
470 '%' => [
471 'min' => 0,
472 'max' => 100,
473 ],
474 ],
475 'default' => [
476 'unit' => 'px',
477 'size' => '90',
478 ],
479 'selectors' => [
480 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'width: {{SIZE}}{{UNIT}};'
481 ],
482 ]
483 );
484 $this->add_responsive_control(
485 'play_btn_height',
486 [
487 'label' => esc_html__( 'Button Height', 'enteraddons' ),
488 'type' => Controls_Manager::SLIDER,
489 'size_units' => [ 'px', '%' ],
490 'range' => [
491 'px' => [
492 'min' => 0,
493 'max' => 1000,
494 'step' => 1,
495 ],
496 '%' => [
497 'min' => 0,
498 'max' => 100,
499 ],
500 ],
501 'default' => [
502 'unit' => 'px',
503 'size' => '90',
504 ],
505 'selectors' => [
506 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'height: {{SIZE}}{{UNIT}};'
507 ],
508 ]
509 );
510 $this->add_control(
511 'play_btn_icon_color',
512 [
513 'label' => esc_html__( 'Button Icon Color', 'enteraddons' ),
514 'type' => \Elementor\Controls_Manager::COLOR,
515 'selectors' => [
516 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn i' => 'color: {{VALUE}}',
517 ],
518 ]
519 );
520 $this->add_responsive_control(
521 'play_btn_icon_size',
522 [
523 'label' => esc_html__( 'Icon Size', 'enteraddons' ),
524 'type' => Controls_Manager::SLIDER,
525 'size_units' => [ 'px', '%' ],
526 'range' => [
527 'px' => [
528 'min' => 0,
529 'max' => 1000,
530 'step' => 1,
531 ],
532 '%' => [
533 'min' => 0,
534 'max' => 100,
535 ],
536 ],
537 'default' => [
538 'unit' => 'px',
539 'size' => '35',
540 ],
541 'selectors' => [
542 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn i' => 'font-size: {{SIZE}}{{UNIT}};'
543 ],
544 ]
545 );
546 $this->add_responsive_control(
547 'play_btn_icon_margin',
548 [
549 'label' => esc_html__( 'Margin', 'enteraddons' ),
550 'type' => Controls_Manager::DIMENSIONS,
551 'devices' => [ 'desktop', 'tablet', 'mobile' ],
552 'size_units' => [ 'px', '%', 'em' ],
553 'selectors' => [
554 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
555 ],
556 ]
557 );
558 $this->add_group_control(
559 \Elementor\Group_Control_Border::get_type(),
560 [
561 'name' => 'play_btn_border',
562 'label' => esc_html__( 'Button Border', 'enteraddons' ),
563 'selector' => '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn',
564 ]
565 );
566 $this->add_responsive_control(
567 'play_btn_radius',
568 [
569 'label' => esc_html__( 'Button Border Radius', 'enteraddons' ),
570 'type' => Controls_Manager::DIMENSIONS,
571 'devices' => [ 'desktop', 'tablet', 'mobile' ],
572 'size_units' => [ 'px', '%', 'em' ],
573 'selectors' => [
574 '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
575 ],
576 ]
577 );
578 $this->add_group_control(
579 \Elementor\Group_Control_Box_Shadow::get_type(),
580 [
581 'name' => 'play_btn_shadow',
582 'label' => esc_html__( 'Button Box Shadow', 'enteraddons' ),
583 'selector' => '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn',
584 ]
585 );
586 $this->add_group_control(
587 \Elementor\Group_Control_Background::get_type(),
588 [
589 'name' => 'play_btn_background',
590 'label' => esc_html__( 'Background', 'enteraddons' ),
591 'types' => [ 'classic', 'gradient' ],
592 'selector' => '{{WRAPPER}} .enteraddons-video-wrap .vdo_btn',
593 ]
594 );
595 $this->add_control(
596 'play_btn_animation_color_one',
597 [
598 'label' => esc_html__( 'Animation Color 1', 'enteraddons' ),
599 'type' => \Elementor\Controls_Manager::COLOR
600 ]
601 );
602 $this->add_control(
603 'play_btn_animation_color_two',
604 [
605 'label' => esc_html__( 'Animation Color 2', 'enteraddons' ),
606 'type' => \Elementor\Controls_Manager::COLOR
607 ]
608 );
609 $this->end_controls_section();
610
611 }
612
613 protected function render() {
614
615 // get settings
616 $settings = $this->get_settings_for_display();
617
618 // Template render
619 $obj = new Video_Button_Template();
620 $obj::setDisplaySettings( $settings );
621 $obj->renderTemplate();
622 }
623
624 public function get_script_depends() {
625 return [ 'enteraddons-main', 'magnific-popup'];
626 }
627
628 public function get_style_depends() {
629 return [ 'enteraddons-global-style', 'magnific-popup' ];
630 }
631
632
633 }
634