<?php
namespace Website\Widgets\Video; use Moto; class Widget extends Moto\System\Widgets\AbstractWidget { protected $_name = 'video'; protected static $_defaultProperties = array( 'align' => array( 'desktop' => 'left', 'tablet' => '', 'mobile-v' => '', 'mobile-h' => '', ), 'preset' => 'default', 'animation' => '', 'spacing' => array( 'top' => 'auto', 'right' => 'auto', 'bottom' => 'auto', 'left' => 'auto', ), 'uri' => array( 'src' => '', ), 'settings' =>[ 'autoplay' => false, 'muted' => false ], ); public function getVideoUrl() { $url = $this->getPropertyValue('uri.src'); if ($this->isPreviewMode()) { return $url; } $url = rtrim($url, '?& '); if (strpos($url, '?') === false) { $url .= '?'; } else { $url .= '&'; } $url .= 'mute=' . (int) $this->getPropertyValue('settings.muted') . '&muted=' . (int) $this->getPropertyValue('settings.muted') . '&autoplay=' . (int) $this->getPropertyValue('settings.autoplay'); return $url; } protected $_templateType = 'templates'; protected $_widgetId = true; } 