IMPR: Add video files

This commit is contained in:
Tony Air 2022-07-08 19:19:50 +02:00
parent 2f7d358dbe
commit c3c268488e
2 changed files with 23 additions and 17 deletions

View File

@ -9,15 +9,12 @@
namespace A2nt\ElementalBasics\Extensions;
use A2nt\ElementalBasics\Elements\SliderElement;
use DNADesign\Elemental\Models\BaseElement;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Assets\File;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\DatetimeField;
use SilverStripe\Forms\ToggleCompositeField;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\ValidationResult;
/**
@ -36,6 +33,10 @@ class SlideImageEx extends DataExtension
'DateOff' => 'Datetime',
];
private static $has_one = [
'VideoFile' => File::class,
];
private $_cache = [
'element' => [],
];

View File

@ -1,5 +1,10 @@
<% if $Video || $Image %>
<% if $Video %>
<% if $VideoFile %>
<video controls="controls">
<source src="{$VideoFile.Link}" type="video/mp4" />
Your browser does not support the video tag.
</video>
<% else_if $Video %>
<div class="video">
$Video.EmbedHTML.RAW
</div>