本文整理匯總了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;
}