/** * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->dataFieldByName('Title')->setTitle('Video Title'); $fields->dataFieldByName('Content')->setTitle('Video Description'); $fields->insertBefore(TextField::create('Time', 'Video Duration')->setDescription('ex. mm:ss'), 'Content'); // poster $PosterField = UploadField::create('Image', 'Poster Image')->setFolderName('Uploads/Video/Images')->setConfig('allowedMaxFileNumber', 1)->setDescription('Placeholder image until video is played.'); $PosterField->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png'); $PosterField->getValidator()->setAllowedMaxFileSize(VIDEO_IMAGE_FILE_SIZE_LIMIT); $fields->insertBefore($PosterField, 'Content'); // mp4 upload if (class_exists('ChunkedUploadField')) { $MP4Field = ChunkedUploadField::create('MP4Video'); } else { $MP4Field = new UploadField('MP4Video'); } $MP4Field->setTitle('MP4 Video')->setFolderName('Uploads/Video/MP4Video')->setConfig('allowedMaxFileNumber', 1)->setDescription('Required. Format compatible with most browsers.'); $MP4Field->getValidator()->setAllowedExtensions(array('mp4', 'm4v')); $MP4Field->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT); // ogg upload if (class_exists('ChunkedUploadField')) { $OggField = ChunkedUploadField::create('OggVideo'); } else { $OggField = UploadField::create('OggVideo'); } $OggField->setTitle('Ogg Video')->setFolderName('Uploads/Video/OggVideo')->setConfig('allowedMaxFileNumber', 1)->setDescription('Optional. Format compatible with FireFox.'); $OggField->getValidator()->setAllowedExtensions(array('ogv', 'ogg')); $OggField->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT); // webm upload if (class_exists('ChunkedUploadField')) { $WebMField = ChunkedUploadField::create('WebMVideo'); } else { $WebMField = UploadField::create('WebMVideo'); } $WebMField->setTitle('WebM Video')->setFolderName('Uploads/Video/WebMVideo')->setConfig('allowedMaxFileNumber', 1)->setDescription('Optional. Format compatible with Chrome.'); $WebMField->getValidator()->setAllowedExtensions(array('webm')); $WebMField->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT); $fields->addFieldsToTab('Root.Video', array($MP4Field, $WebMField, $OggField)); $this->extend('updateCMSFields', $fields); return $fields; }