当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadField::setTitle方法代码示例

本文整理汇总了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;
 }
开发者ID:korthjp17,项目名称:silverstripe-html5video,代码行数:45,代码来源:Video.php


注:本文中的UploadField::setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。