示例#1
0
 /**
  * Build the file selection form.
  *
  * @return Form
  */
 public function Form()
 {
     // Find out the requested folder ID.
     $folderID = $this->parent->getRequest()->requestVar('ParentID');
     if (!isset($folderID)) {
         $folder = Folder::find_or_make($this->folderName);
         $folderID = $folder ? $folder->ID : 0;
     }
     // Construct the form
     $action = new FormAction('doAttach', _t('UploadField.AttachFile', 'Attach file(s)'));
     $action->addExtraClass('ss-ui-action-constructive icon-accept');
     $form = new Form($this, 'Form', new FieldList($this->getListField($folderID)), new FieldList($action));
     // Add a class so we can reach the form from the frontend.
     $form->addExtraClass('uploadfield-form');
     return $form;
 }