Skip to content

Commit

Permalink
Fixed poster image field not working (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
mak001 authored Jul 26, 2018
1 parent 5dd8c1e commit 7964a8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Pages/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,8 @@ public function getCMSFields()
$content->setTitle('Video Description');
}

$fields->insertBefore(
TextField::create('Time', 'Video Duration')
->setDescription('ex. mm:ss'),
'Content'
);

// poster
$PosterField = UploadField::create(Image::class, 'Poster Image')
$PosterField = UploadField::create('Image', 'Poster Image')
->setFolderName('Uploads/Video/Images')
->setAllowedMaxFileNumber(1)
->setAllowedExtensions([
Expand All @@ -93,11 +87,6 @@ public function getCMSFields()
->setDescription('Preview image for the video.');
$PosterField->getValidator()->setAllowedMaxFileSize(VIDEO_IMAGE_FILE_SIZE_LIMIT);

$fields->insertBefore(
$PosterField,
'Content'
);

$MP4Field = new UploadField('MP4Video');
$MP4Field
->setTitle('MP4 Video')
Expand Down Expand Up @@ -126,6 +115,9 @@ public function getCMSFields()
$WebMField->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT);

$fields->addFieldsToTab('Root.Video', [
TextField::create('Time', 'Video Duration')
->setDescription('ex. mm:ss'),
$PosterField,
$MP4Field,
$WebMField,
$OggField,
Expand Down
6 changes: 6 additions & 0 deletions tests/Pages/VideoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public function testGetCMSValidator()

public function testGetRelatedVideos()
{
/** @var Video $object */
$object = Injector::inst()->create(Video::class);
$this->assertFalse($object->getRelatedVideos());

// TODO

$this->markTestSkipped();
}
}

0 comments on commit 7964a8d

Please sign in to comment.