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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106671 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-06-18 01:15:22 +00:00 committed by Sam Minnee
parent 8cfe7aa11b
commit 7b90d5e94d

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);