本文整理匯總了PHP中UploadField::getAllowedMaxFileNumber方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadField::getAllowedMaxFileNumber方法的具體用法?PHP UploadField::getAllowedMaxFileNumber怎麽用?PHP UploadField::getAllowedMaxFileNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadField
的用法示例。
在下文中一共展示了UploadField::getAllowedMaxFileNumber方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getListField
/**
* @param $folderID The ID of the folder to display.
* @return FormField
*/
protected function getListField($folderID)
{
// Generate the folder selection field.
$folderField = new TreeDropdownField('ParentID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder');
$folderField->setValue($folderID);
// Generate the file list field.
$config = GridFieldConfig::create();
$config->addComponent(new GridFieldSortableHeader());
$config->addComponent(new GridFieldFilterHeader());
$config->addComponent($columns = new GridFieldDataColumns());
$columns->setDisplayFields(array('StripThumbnail' => '', 'Name' => 'Name', 'Title' => 'Title'));
$config->addComponent(new GridFieldPaginator(8));
// If relation is to be autoset, we need to make sure we only list compatible objects.
$baseClass = $this->parent->getRelationAutosetClass();
// Create the data source for the list of files within the current directory.
$files = DataList::create($baseClass)->filter('ParentID', $folderID);
$fileField = new GridField('Files', false, $files, $config);
$fileField->setAttribute('data-selectable', true);
if ($this->parent->getAllowedMaxFileNumber() !== 1) {
$fileField->setAttribute('data-multiselect', true);
}
$selectComposite = new CompositeField($folderField, $fileField);
return $selectComposite;
}
示例2: getListField
/**
* @param int $folderID The ID of the folder to display.
* @return FormField
*/
protected function getListField($folderID)
{
// Generate the folder selection field.
$folderField = new TreeDropdownField('ParentID', _t('HTMLEditorField.FOLDER', 'Folder'), 'Folder');
$folderField->setValue($folderID);
// Generate the file list field.
$config = GridFieldConfig::create();
$config->addComponent(new GridFieldSortableHeader());
$config->addComponent(new GridFieldFilterHeader());
$config->addComponent($colsComponent = new GridFieldDataColumns());
$colsComponent->setDisplayFields(array('StripThumbnail' => '', 'Title' => singleton('File')->fieldLabel('Title'), 'Created' => singleton('File')->fieldLabel('Created'), 'Size' => singleton('File')->fieldLabel('Size')));
$colsComponent->setFieldCasting(array('Created' => 'DBDatetime->Nice'));
// Set configurable pagination for file list field
$pageSize = Config::inst()->get(get_class($this), 'page_size');
$config->addComponent(new GridFieldPaginator($pageSize));
// If relation is to be autoset, we need to make sure we only list compatible objects.
$baseClass = $this->parent->getRelationAutosetClass();
// Create the data source for the list of files within the current directory.
$files = DataList::create($baseClass)->exclude('ClassName', 'Folder');
if ($folderID) {
$files = $files->filter('ParentID', $folderID);
}
$fileField = new GridField('Files', false, $files, $config);
$fileField->setAttribute('data-selectable', true);
if ($this->parent->getAllowedMaxFileNumber() !== 1) {
$fileField->setAttribute('data-multiselect', true);
}
$selectComposite = new CompositeField($folderField, $fileField);
return $selectComposite;
}