mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT ImageField now shows only images and folders under the 'From the File Store' tree
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@83346 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1b4eed87ec
commit
e1ea8759be
@ -22,4 +22,17 @@ class ImageField extends FileIFrameField {
|
|||||||
return _t('ImageField.IMAGE', 'Image');
|
return _t('ImageField.IMAGE', 'Image');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the filter, so the dropdown displays only images and folders.
|
||||||
|
*
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
public function EditFileForm() {
|
||||||
|
$filter = create_function('$item', 'return ($item->ClassName=="Folder" || $item->ClassName=="Image");');
|
||||||
|
|
||||||
|
$form = parent::EditFileForm();
|
||||||
|
$form->dataFieldByName('ExistingFile')->setFilterFunction($filter);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user