本文整理汇总了PHP中UploadField::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::getConfig方法的具体用法?PHP UploadField::getConfig怎么用?PHP UploadField::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::getConfig方法的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(new GridFieldDataColumns());
$config->addComponent(new GridFieldPaginator(10));
// If relation is to be autoset, we need to make sure we only list compatible objects.
$baseClass = null;
if ($this->parent->relationAutoSetting) {
$baseClass = $this->parent->getRelationAutosetClass();
}
// By default we can attach anything that is a file, or derives from file.
if (!$baseClass) {
$baseClass = 'File';
}
// 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->getConfig('allowedMaxFileNumber') > 1) {
$fileField->setAttribute('data-multiselect', true);
}
$selectComposite = new CompositeField($folderField, $fileField);
return $selectComposite;
}
示例2: 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(new GridFieldDataColumns());
$config->addComponent(new GridFieldPaginator(10));
// Create the data source for the list of files within the current directory.
$files = DataList::create('File')->filter('ParentID', $folderID);
// If relation is to be autoset, make sure only objects from related class are listed.
if ($this->parent->relationAutoSetting) {
if ($relationClass = $this->parent->getRelationAutosetClass()) {
$files->filter('ClassName', $relationClass);
}
}
$fileField = new GridField('Files', false, $files, $config);
$fileField->setAttribute('data-selectable', true);
if($this->parent->getConfig('allowedMaxFileNumber') > 1) $fileField->setAttribute('data-multiselect', true);
$selectComposite = new CompositeField(
$folderField,
$fileField
);
return $selectComposite;
}