From f812e5602269b1043dfe02698ca32eef034d7014 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 2 May 2012 17:50:08 +0200 Subject: [PATCH] ENHANCEMENT Moving action buttons in AssetAdmin to "details" tab (fixes #7221) --- code/controllers/AssetAdmin.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 14bc209d..9f941ed7 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -253,6 +253,21 @@ JS ) )); + // Move actions to "details" tab (they don't make sense on list/tree view) + $actions = $form->Actions(); + $saveBtn = $actions->fieldByName('action_save'); + $deleteBtn = $actions->fieldByName('action_delete'); + if(($saveBtn || $deleteBtn) && $fields->fieldByName('Root.DetailsView')) { + $actions->removeByName('action_save'); + $actions->removeByName('action_delete'); + $fields->addFieldToTab( + 'Root.DetailsView', + CompositeField::create($saveBtn,$deleteBtn)->addExtraClass('Actions') + ); + } + + + $fields->setForm($form); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); // TODO Can't merge $FormAttributes in template at the moment