BUGFIX Fixed ImageField->EditFileForm() to list subclasses of Image in tree dropdown (fixes #5708, thanks keeny) (from r106671)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112533 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 03:02:17 +00:00
parent 4d665ce268
commit ceb27c4a41

View File

@ -28,7 +28,7 @@ class ImageField extends FileIFrameField {
* @return Form
*/
public function EditFileForm() {
$filter = create_function('$item', 'return ($item->ClassName=="Folder" || $item->ClassName=="Image");');
$filter = create_function('$item', 'return (in_array("Folder", ClassInfo::ancestry($item->ClassName)) || in_array("Image", ClassInfo::ancestry($item->ClassName)));');
$form = parent::EditFileForm();
$form->dataFieldByName('ExistingFile')->setFilterFunction($filter);