diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index 98bbbbb2..ef22f4f6 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -279,10 +279,19 @@ HTML; } } + /** + * @return Form + */ + function EditForm($request = null) { + return $this->getEditForm(); + } + /** * Return the form that displays the details of a folder, including a file list and fields for editing the folder name. */ function getEditForm($id = null) { + if(!$id) $id = $this->currentPageID(); + if($id && $id != "root") { $record = DataObject::get_by_id("File", $id); } else { diff --git a/code/CMSMain.php b/code/CMSMain.php index 36c62a71..66b5ef6a 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -305,6 +305,13 @@ JS; return $this->getNewItem($id); } } + + /** + * @return Form + */ + function EditForm($request = null) { + return $this->getEditForm(); + } /** * Calls {@link SiteTree->getCMSFields()} diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 0018931d..efbfd783 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -771,30 +771,24 @@ JS; } /** - * Uses {@link getEditForm()} to retrieve an edit form - * based on the submitted data. Used for form submissions, - * not for template rendering. + * Retrieves an edit form, either for display, or to process submitted data. + * Also used in the template rendered through {@link Right()} in the $EditForm placeholder. * - * @param HTTPRequest $request - * @return Form - */ - function EditForm($request = null) { - return $this->getEditForm($request ? $request->requestVar('ID') : null); - } - - /** - * Gets the edit form of a specific record. Will usually construct itself - * from {@link DataObject->getCMSFields()} for the specific managed subclass - * defined in {@link LeftAndMain::$tree_class}. + * This is a "pseudo-abstract" methoed, usually connected to a {@link getEditForm()} + * method in a concrete subclass. This method can accept a record identifier, + * selected either in custom logic, or through {@link currentPageID()}. + * The form usually construct itself from {@link DataObject->getCMSFields()} + * for the specific managed subclass defined in {@link LeftAndMain::$tree_class}. * - * @param int $id ID of a record for {@link LeftAndMain::$tree_class} (Optional) + * @param HTTPRequest $request Optionally contains an identifier for the + * record to load into the form. * @return Form Should return a form regardless wether a record has been found. * Form might be readonly if the current user doesn't have the permission to edit * the record. */ - function getEditForm($id = null) { - die('getEditForm(): Not implemented'); - } + function EditForm($request = null) { + return $this->EmptyForm(); + } /** * Returns a placeholder form, used by {@link getEditForm()} if no record is selected. @@ -839,9 +833,9 @@ JS; } public function printable() { - $id = $_REQUEST['ID'] ? $_REQUEST['ID'] : $this->currentPageID(); - - if($id) $form = $this->getEditForm($id); + $form = $this->getEditForm($this->currentPageID()); + if(!$form) return false; + $form->transform(new PrintableTransformation()); $form->actions = null;