本文整理汇总了PHP中UploadField::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::setTitle方法的具体用法?PHP UploadField::setTitle怎么用?PHP UploadField::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
/**
* @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;
}