mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #78 from halkyon/uploadfile_allowed_extensions
ENHANCEMENT Indicate which file extensions are allowed to be uploaded
This commit is contained in:
commit
1c2ccaecb1
@ -72,10 +72,24 @@ class CMSFileAddController extends LeftAndMain {
|
||||
$uploadField->setFolderName(ASSETS_DIR);
|
||||
}
|
||||
|
||||
$exts = $uploadField->getValidator()->getAllowedExtensions();
|
||||
asort($exts);
|
||||
|
||||
$form = new Form(
|
||||
$this,
|
||||
'getEditForm',
|
||||
new FieldList($uploadField, new HiddenField('ID')),
|
||||
$this,
|
||||
'getEditForm',
|
||||
new FieldList(
|
||||
$uploadField,
|
||||
new LiteralField(
|
||||
'AllowedExtensions',
|
||||
sprintf(
|
||||
'<p>%s: %s</p>',
|
||||
_t('AssetAdmin.ALLOWEDEXTS', 'Allowed extensions'),
|
||||
implode('<em>, </em>', $exts)
|
||||
)
|
||||
),
|
||||
new HiddenField('ID')
|
||||
),
|
||||
new FieldList()
|
||||
);
|
||||
$form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
|
||||
@ -121,4 +135,4 @@ class CMSFileAddController extends LeftAndMain {
|
||||
return $items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user