/**
  * Adds the filter, so the dropdown displays only images and folders.
  *
  * @return Form
  */
 public function EditFileForm()
 {
     $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);
     return $form;
 }
예제 #2
0
 /**
  * Adds the filter, so the dropdown displays only images and folders.
  *
  * @return Form
  */
 public function EditFileForm()
 {
     Deprecation::notice('3.0', 'Use UploadField', Deprecation::SCOPE_CLASS);
     $filter = create_function('$item', 'return (in_array("Folder", ClassInfo::ancestry($item->ClassName)) || in_array("Image", ClassInfo::ancestry($item->ClassName)));');
     $form = parent::EditFileForm();
     $form->Fields()->dataFieldByName('ExistingFile')->setFilterFunction($filter);
     return $form;
 }