/**
  * @param Int $id
  * @param FieldList $fields
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     if (!$fields) {
         $fields = $form->Fields();
     }
     $actions = $form->Actions();
     if ($record) {
         $deletedFromStage = $record->IsDeletedFromStage;
         $deleteFromLive = !$record->ExistsOnLive;
         $fields->push($idField = new HiddenField("ID", false, $id));
         // Necessary for different subsites
         $fields->push($liveLinkField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
         $fields->push($liveLinkField = new HiddenField("LiveLink"));
         $fields->push($stageLinkField = new HiddenField("StageLink"));
         if ($record->ID && is_numeric($record->ID)) {
             $liveLink = $record->getAbsoluteLiveLink();
             if ($liveLink) {
                 $liveLinkField->setValue($liveLink);
             }
             if (!$deletedFromStage) {
                 $stageLink = Controller::join_links($record->AbsoluteLink(), '?stage=Stage');
                 if ($stageLink) {
                     $stageLinkField->setValue($stageLink);
                 }
             }
         }
         // Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
         /*if(in_array('CMSPreviewable', class_implements($record)) && !$fields->fieldByName('SilverStripeNavigator')) {
         			$navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator());
         			$navField->setAllowHTML(true);
         			$fields->push($navField);
         		}*/
         // getAllCMSActions can be used to completely redefine the action list
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = $record->getCMSActions();
         }
         // Use <button> to allow full jQuery UI styling
         $actionsFlattened = $actions->dataFields();
         if ($actionsFlattened) {
             foreach ($actionsFlattened as $action) {
                 $action->setUseButtonTag(true);
             }
         }
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
         } else {
             $validator = new RequiredFields();
         }
         $form = new Form($this, "EditForm", $fields, $actions, $validator);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         $form->addExtraClass('cms-edit-form content-module');
         $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
         // TODO Can't merge $FormAttributes in template at the moment
         $form->addExtraClass('center ' . $this->BaseCSSClasses());
         $form->setAttribute('data-pjax-fragment', 'CurrentForm');
         if (!$record->canEdit() || $deletedFromStage) {
             $readonlyFields = $form->Fields()->makeReadonly();
             $form->setFields($readonlyFields);
         }
         $this->extend('updateEditForm', $form);
         return $form;
     } else {
         if ($id) {
             return new Form($this, "EditForm", new FieldList(new LabelField('ModuleDoesntExistLabel', _t('ContentModule.MODULENOTEXISTS', "This module doesn't exist"))), new FieldList());
         }
     }
     return $this->ListViewForm();
 }
 public function getEditForm($id)
 {
     $record = $this->getRecord($id);
     if ($record) {
         if ($record->IsDeletedFromStage) {
             $record->Status = _t('CMSMain.REMOVEDFD', "Removed from the draft site");
         }
         $fields = $record->getCMSFields($this);
         if ($fields == null) {
             user_error("getCMSFields returned null on a '" . get_class($record) . "' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
         }
         $fields->push($idField = new HiddenField("ID"));
         $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
         $fields->push($stageURLField = new HiddenField("StageURLSegment"));
         /*if( substr($record->ID, 0, 3 ) == 'new' )*/
         $fields->push(new HiddenField('Sort', '', $record->Sort));
         $idField->setValue($id);
         if ($record->ID && is_numeric($record->ID)) {
             $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = {$record->ID}");
             if ($liveRecord) {
                 $liveURLField->setValue($liveRecord->AbsoluteLink());
             }
         }
         if (!$record->IsDeletedFromStage) {
             $stageURLField->setValue($record->AbsoluteLink());
         }
         // getAllCMSActions can be used to completely redefine the action list
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = $record->getCMSActions();
         }
         // Add a default or custom validator.
         // @todo Currently the default Validator.js implementation
         //  adds javascript to the document body, meaning it won't
         //  be included properly if the associated fields are loaded
         //  through ajax. This means only serverside validation
         //  will kick in for pages+validation loaded through ajax.
         //  This will be solved by using less obtrusive javascript validation
         //  in the future, see http://open.silverstripe.com/ticket/2915 and http://open.silverstripe.com/ticket/3386
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
         } else {
             $validator = new RequiredFields();
         }
         // The clientside (mainly LeftAndMain*.js) rely on ajax responses
         // which can be evaluated as javascript, hence we need
         // to override any global changes to the validation handler.
         $validator->setJavascriptValidationHandler('prototype');
         $form = new Form($this, "EditForm", $fields, $actions, $validator);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         if (!$record->canEdit() || $record->IsDeletedFromStage) {
             $readonlyFields = $form->Fields()->makeReadonly();
             $form->setFields($readonlyFields);
         }
         $this->extend('updateEditForm', $form);
         return $form;
     }
     if ($id == 0 || $id == 'root') {
         return $this->RootForm();
     } else {
         if ($id) {
             return new Form($this, "EditForm", new FieldSet(new LabelField('PageDoesntExistLabel', _t('CMSMain.PAGENOTEXISTS', "This page doesn't exist"))), new FieldSet());
         }
     }
 }
Example #3
0
 /**
  * Calls {@link SiteTree->getCMSFields()}
  */
 public function getEditForm($id = null)
 {
     // Include JavaScript to ensure HtmlEditorField works.
     HtmlEditorField::include_js();
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     if (!$id) {
         $id = $this->currentPageID();
     }
     $record = $id && $id != "root" ? $this->getRecord($id) : null;
     $fields = $form->Fields();
     $actions = $form->Actions();
     if ($record) {
         $fields->push($idField = new HiddenField("ID", false, $id));
         // Necessary for different subsites
         $fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
         $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
         $fields->push($stageURLField = new HiddenField("StageURLSegment"));
         $fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
         $fields->push(new HiddenField('Sort', '', $record->Sort));
         if ($record->ID && is_numeric($record->ID)) {
             $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = {$record->ID}");
             if ($liveRecord) {
                 $liveURLField->setValue($liveRecord->AbsoluteLink());
             }
         }
         if (!$record->IsDeletedFromStage) {
             $stageURLField->setValue($record->AbsoluteLink());
         }
         // getAllCMSActions can be used to completely redefine the action list
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = $record->getCMSActions();
         }
         // Add a default or custom validator.
         // @todo Currently the default Validator.js implementation
         //  adds javascript to the document body, meaning it won't
         //  be included properly if the associated fields are loaded
         //  through ajax. This means only serverside validation
         //  will kick in for pages+validation loaded through ajax.
         //  This will be solved by using less obtrusive javascript validation
         //  in the future, see http://open.silverstripe.com/ticket/2915 and http://open.silverstripe.com/ticket/3386
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
         } else {
             $validator = new RequiredFields();
         }
         // The clientside (mainly LeftAndMain*.js) rely on ajax responses
         // which can be evaluated as javascript, hence we need
         // to override any global changes to the validation handler.
         $validator->setJavascriptValidationHandler('prototype');
         $form = new Form($this, "EditForm", $fields, $actions, $validator);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         if (!$record->canEdit() || $record->IsDeletedFromStage) {
             $readonlyFields = $form->Fields()->makeReadonly();
             $form->setFields($readonlyFields);
         }
         $this->extend('updateEditForm', $form);
         return $form;
     }
     if ($id == 0 || $id == 'root') {
         return $this->RootForm();
     } else {
         if ($id) {
             return new Form($this, "EditForm", new FieldSet(new LabelField('PageDoesntExistLabel', _t('CMSMain.PAGENOTEXISTS', "This page doesn't exist"))), new FieldSet());
         }
     }
 }
 /**
  * Gets the form used for viewing snippets
  * @param {int} $id ID of the record to fetch
  * @param {FieldList} $fields Fields to use
  * @return {Form} Form to be used
  */
 public function getEditForm($id = null, $fields = null)
 {
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     if (!$fields) {
         $fields = $form->Fields();
     }
     $actions = $form->Actions();
     if ($record) {
         $fields->push($idField = new HiddenField("ID", false, $id));
         $versions = $record->Versions()->filter('ID:not', $record->CurrentVersionID)->Map('ID', 'Created');
         $actions = new FieldList(new FormAction('doCopy', _t('CodeBank.COPY', '_Copy')), new FormAction('doEditRedirect', _t('CodeBank.EDIT', '_Edit')), new FormAction('doExport', _t('CodeBank.EXPORT', '_Export')), new FormAction('doPrint', _t('CodeBank.PRINT', '_Print')), new LabelField('Revision', _t('CodeBank.REVISION', '_Revision') . ': '), DropdownField::create('RevisionID', '', $versions, $this->urlParams['OtherID'])->setEmptyString('{' . _t('CodeBank.CURRENT_REVISION', '_Current Revision') . '}')->setDisabled($record->Versions()->Count() <= 1)->addExtraClass('no-change-track'), FormAction::create('compareRevision', _t('CodeBank.COMPARE_WITH_CURRENT', '_Compare with Current'))->setDisabled($record->Versions()->Count() <= 1 || empty($this->urlParams['OtherID']) || !is_numeric($this->urlParams['OtherID'])));
         // Use <button> to allow full jQuery UI styling
         $actionsFlattened = $actions->dataFields();
         if ($actionsFlattened) {
             foreach ($actionsFlattened as $action) {
                 if ($action instanceof FormAction) {
                     $action->setUseButtonTag(true);
                 }
             }
         }
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
         } else {
             $validator = new RequiredFields();
         }
         if ($record->Package() && $record->Package() !== false && $record->Package()->ID != 0) {
             $package = new ArrayList(array($record->Package()));
         } else {
             $package = null;
         }
         $fields->insertBefore($fields->dataFieldByName('Title'), 'LanguageID');
         $fields->replaceField('PackageID', new PackageViewField('PackageID', _t('Snippet.PACKAGE', '_Package'), $package, $record->ID));
         $fields->replaceField('Text', HighlightedContentField::create('SnippetText', _t('Snippet.CODE', '_Code'), $record->Language()->HighlightCode)->setForm($form));
         $fields->replaceField('Tags', new TagsViewField('Tags', _t('Snippet.TAGS_COLUMN', '_Tags')));
         $fields->addFieldToTab('Root.Main', $creator = ReadonlyField::create('CreatorName', _t('CodeBank.CREATOR', '_Creator'), $record->Creator() && $record->Creator()->ID > 0 ? '<a href="' . $this->Link() . '?creator=' . $record->CreatorID . '">' . $record->Creator()->Name . '</a>' : _t('CodeBank.UNKNOWN_USER', '_Unknown User'))->setForm($form));
         $creator->dontEscape = true;
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('LanguageName', _t('CodeBank.LANGUAGE', '_Language'), $record->Language()->Name)->setForm($form));
         $fields->addFieldToTab('Root.Main', DatetimeField_Readonly::create('LastModified', _t('CodeBank.LAST_MODIFIED', '_Last Modified'), $record->CurrentVersion->LastEdited)->setForm($form));
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('LastEditorName', _t('CodeBank.LAST_EDITED_BY', '_Last Edited By'), $record->LastEditor() && $record->LastEditor()->ID > 0 ? $record->LastEditor()->Name : _t('CodeBank.UNKNOWN_USER', '_Unknown User'))->setForm($form));
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('SnippetID', _t('CodeBank.ID', '_ID'), $record->ID));
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('CurrentVersionID', _t('CodeBank.VERSION', '_Version')));
         $fields->push(new HiddenField('ID', 'ID'));
         $form = new Form($this, 'EditForm', $fields, $actions, $validator);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         $form->addExtraClass('cms-edit-form');
         $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
         $form->addExtraClass('center ' . $this->BaseCSSClasses());
         $form->setAttribute('data-pjax-fragment', 'CurrentForm');
         //Swap content for version text
         if (!empty($this->urlParams['OtherID']) && is_numeric($this->urlParams['OtherID'])) {
             $version = $record->Version(intval($this->urlParams['OtherID']));
             if (!empty($version) && $version !== false && $version->ID != 0) {
                 $fields->dataFieldByName('SnippetText')->setValue($version->Text);
                 $fields->dataFieldByName('LastModified')->setValue($version->LastEdited);
                 $fields->dataFieldByName('CurrentVersionID')->setValue($version->ID);
             }
             $form->Fields()->insertBefore(new LiteralField('NotCurrentVersion', '<p class="message warning">' . _t('CodeBank.NOT_CURRENT_VERSION', '_You are viewing a past version of this snippet\'s content, {linkopen}click here{linkclose} to view the current version', array('linkopen' => '<a href="admin/codeBank/show/' . $record->ID . '">', 'linkclose' => '</a>')) . '</p>'), 'Title');
         }
         $readonlyFields = $form->Fields()->makeReadonly();
         $form->setFields($readonlyFields);
         $this->extend('updateEditForm', $form);
         $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: ' . $this->getVersion() . '</p>'));
         Requirements::add_i18n_javascript(CB_DIR . '/javascript/lang');
         Requirements::add_i18n_javascript('mysite/javascript/lang');
         Requirements::javascript(CB_DIR . '/javascript/external/jquery-zclip/jquery.zclip.min.js');
         Requirements::javascript(CB_DIR . '/javascript/CodeBank.ViewForm.js');
         //Display message telling user to run dev/build because the version numbers are out of sync
         if (CB_VERSION != '@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version != CB_VERSION . ' ' . CB_BUILD_DATE) {
             $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<p class="message error">' . _t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink' => '<a href="dev/build?flush=all">', 'endlink' => '</a>')) . '</p>'), 'Title');
         } else {
             if ($this->hasOldTables()) {
                 $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<p class="message warning">' . _t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink' => '<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink' => '</a>')) . '</p>'), 'Title');
             }
         }
         return $form;
     } else {
         if ($id) {
             $form = CMSForm::create($this, 'EditForm', new FieldList(new TabSet('Root', new Tab('Main', ' ', new LabelField('DoesntExistLabel', _t('CodeBank.SNIPPIT_NOT_EXIST', '_Snippit does not exist'))))), new FieldList())->setHTMLID('Form_EditForm');
             $form->addExtraClass('cms-edit-form');
             $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
             $form->addExtraClass('center ' . $this->BaseCSSClasses());
             $form->setAttribute('data-pjax-fragment', 'CurrentForm');
             //Display message telling user to run dev/build because the version numbers are out of sync
             if (CB_VERSION != '@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version != CB_VERSION . ' ' . CB_BUILD_DATE) {
                 $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<p class="message error">' . _t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink' => '<a href="dev/build?flush=all">', 'endlink' => '</a>')) . '</p>'), 'DoesntExist');
             } else {
                 if ($this->hasOldTables()) {
                     $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<p class="message warning">' . _t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink' => '<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink' => '</a>')) . '</p>'), 'DoesntExistLabel');
                 }
             }
         } else {
             $form = $this->EmptyForm();
             if (Session::get('CodeBank.deletedSnippetID')) {
                 $form->Fields()->push(new HiddenField('ID', 'ID', Session::get('CodeBank.deletedSnippetID')));
             }
             //Display message telling user to run dev/build because the version numbers are out of sync
             if (CB_VERSION != '@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version != CB_VERSION . ' ' . CB_BUILD_DATE) {
                 $form->Fields()->push(new LiteralField('DBUpgrade', '<p class="message error">' . _t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink' => '<a href="dev/build?flush=all">', 'endlink' => '</a>')) . '</p>'));
             } else {
                 if ($this->hasOldTables()) {
                     $form->Fields()->push(new LiteralField('DBUpgrade', '<p class="message warning">' . _t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink' => '<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink' => '</a>')) . '</p>'));
                 }
             }
         }
     }
     $form->disableDefaultAction();
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->addExtraClass('center ' . $this->BaseCSSClasses());
     $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: ' . $this->getVersion() . '</p>'));
     return $form;
 }
Example #5
0
 public function getEditForm($id)
 {
     $record = $this->getRecord($id);
     if ($record) {
         if ($record->DeletedFromStage) {
             $record->Status = _t('CMSMain.REMOVEDFD', "Removed from the draft site");
         }
         $fields = $record->getCMSFields($this);
         if ($fields == null) {
             user_error("getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
         }
         $fields->push($idField = new HiddenField("ID"));
         $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
         $fields->push($stageURLField = new HiddenField("StageURLSegment"));
         /*if( substr($record->ID, 0, 3 ) == 'new' )*/
         $fields->push(new HiddenField('Sort', '', $record->Sort));
         $idField->setValue($id);
         if ($record->ID && is_numeric($record->ID)) {
             $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "`SiteTree`.ID = {$record->ID}");
             if ($liveRecord) {
                 $liveURLField->setValue($liveRecord->AbsoluteLink());
             }
         }
         if (!$record->DeletedFromStage) {
             $stageURLField->setValue($record->AbsoluteLink());
         }
         // getAllCMSActions can be used to completely redefine the action list
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = new FieldSet();
             if ($record->DeletedFromStage) {
                 if ($record->can('CMSEdit')) {
                     $actions->push(new FormAction('revert', _t('CMSMain.RESTORE', 'Restore')));
                     $actions->push(new FormAction('deletefromlive', _t('CMSMain.DELETEFP', 'Delete from the published site')));
                 }
             } else {
                 if ($record->canEdit()) {
                     $actions->push($deleteAction = new FormAction('delete', _t('CMSMain.DELETE', 'Delete from the draft site')));
                     $deleteAction->addExtraClass('delete');
                 }
                 if ($record->hasMethod('getCMSActions')) {
                     $extraActions = $record->getCMSActions();
                     if ($extraActions) {
                         foreach ($extraActions as $action) {
                             $actions->push($action);
                         }
                     }
                 }
                 if ($record->canEdit()) {
                     $actions->push(new FormAction('save', _t('CMSMain.SAVE', 'Save')));
                 }
             }
         }
         $form = new Form($this, "EditForm", $fields, $actions);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         if (!$record->canEdit() || $record->DeletedFromStage) {
             $form->makeReadonly();
         }
         return $form;
     } else {
         if ($id) {
             return new Form($this, "EditForm", new FieldSet(new LabelField(_t('CMSMain.PAGENOTEXISTS', "This page doesn't exist"))), new FieldSet());
         }
     }
 }
Example #6
0
 /**
  * Determines fields and actions for the given {$data_type}, and populates
  * these fields with values from {$data_type} and any connected {$data_type_extra}.
  * Adds default actions ("save" and "delete") if no custom actions are found.
  * Returns an empty form if no fields or actions are found (on first load).
  * 
  * @param $id Number
  * @return Form
  */
 function getEditForm($id)
 {
     if (isset($_GET['debug_profile'])) {
         Profiler::mark('getEditForm');
     }
     $genericData = DataObject::get_by_id($this->stat('data_type'), $id);
     $fields = method_exists($genericData, 'getCMSFields') ? $genericData->getCMSFields() : new FieldSet();
     if (!$fields->dataFieldByName('ID')) {
         $fields->push($idField = new HiddenField("ID", "ID", $id));
         $idField->setValue($id);
     }
     if (method_exists($genericData, 'getGenericStatus')) {
         $genericDataStatus = $genericData->getGenericStatus();
         if ($genericDataStatus) {
             $fields->push($dataStatusField = new ReadonlyField("GenericDataStatus", "", $genericDataStatus));
             $dataStatusField->dontEscape = true;
         }
     }
     $actions = method_exists($genericData, 'getCMSActions') ? $genericData->getCMSActions() : new FieldSet();
     if (!$actions->fieldByName('action_save')) {
         $actions->push(new FormAction('save', _t('GenericDataAdmin.SAVE', 'Save'), 'ajaxAction-save'));
     }
     if (!$actions->fieldByName('action_delete')) {
         $actions->push(new FormAction('delete', _t('GenericDataAdmin.DELETE', 'Delete'), 'ajaxAction-delete'));
     }
     $required = method_exists($genericData, 'getCMSRequiredField') ? $genericData->getCMSRequiredField() : new RequiredFields();
     $form = new Form($this, "EditForm", $fields, $actions, $required);
     if ($this->stat('data_type_extra')) {
         foreach ($this->stat('data_type_extra') as $oneRelated) {
             $oneExtra = $genericData->{$oneRelated}();
             if ($oneExtra) {
                 $allFields = $oneExtra->getAllFields();
                 foreach ($allFields as $k => $v) {
                     $fieldname = $oneRelated . "[" . $k . "]";
                     $allFields[$fieldname] = $v;
                     unset($allFields[$k]);
                 }
                 $form->loadDataFrom($allFields);
             }
         }
     }
     $form->loadDataFrom($genericData);
     $form->disableDefaultAction();
     if (isset($_GET['debug_profile'])) {
         Profiler::unmark('getEditForm');
     }
     return $form;
 }