PluginProbe
Depicter — Popup & Slider Builder / 1.6.2
Depicter — Popup & Slider Builder v1.6.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Document / Models / Elements / Video.php

Video.php in Depicter — Popup & Slider Builder 1.6.2, at app/src/Document/Models/Elements/Video.php

65 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Document\Models\Elements;
3
4 use Averta\Core\Utility\Arr;
5 use Depicter;
6 use Depicter\Document\Models;
7 use Depicter\Html\Html;
8 use Depicter\Services\MediaBridge;
9
10 class Video extends Models\Element
11 {
12
13 public function render() {
14
15 if ( empty( $this->options->source ) ) {
16 return '';
17 }
18
19 $elementsAttrs = [];
20
21 if( isset( $this->options->autoPlay ) ){
22 $elementsAttrs['data-autoplay'] = $this->options->autoPlay ? "true" : "false";
23 }
24 if( isset( $this->options->autoPause ) ){
25 $elementsAttrs['data-auto-pause'] = $this->options->autoPause ? "true" : "false";
26 }
27
28 if( isset( $this->options->goNextSection ) ){
29 $elementsAttrs['data-goto-next'] = $this->options->goNextSection ? "true" : "false";
30 }
31 if( isset( $this->options->loop ) ){
32 $elementsAttrs['data-loop'] = $this->options->loop ? "true" : "false";
33 } else {
34 $elementsAttrs['data-loop'] = "true";
35 }
36
37 $videoAttrs = [
38 'src' => Depicter::media()->getSourceUrl( $this->options->source ),
39 'preload' => 'metadata'
40 ];
41
42 if( !empty( $this->options->controls ) ){
43 $videoAttrs['controls'] = "";
44 }
45 if( !empty( $this->options->mute ) ){
46 $videoAttrs['muted'] = "";
47 }
48
49 $elementsAttrs = Arr::merge( $this->getDefaultAttributes(), $elementsAttrs );
50 if ( isset( $elementsAttrs['data-height'] ) ) {
51 $elementsAttrs['data-height'] = 'auto,,';
52 }
53
54 $div = Html::div( $elementsAttrs );
55
56 $video = "\n\t" . Html::video( $videoAttrs ) . "\n";
57
58 if ( false !== $a = $this->getLinkTag() ) {
59 return $a->nest( $div->nest( $video ) );
60 }
61
62 return $div->nest( $video ) . "\n";
63 }
64 }
65