Skip to content

Commit

Permalink
ENHANCEMENT Moving action buttons in AssetAdmin to "details" tab (fix…
Browse files Browse the repository at this point in the history
…es #7221)
  • Loading branch information
chillu committed May 3, 2012
1 parent f8abcd8 commit f812e56
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions code/controllers/AssetAdmin.php
Expand Up @@ -253,6 +253,21 @@ public function getEditForm($id = null, $fields = null) {
)
));

// 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
Expand Down

0 comments on commit f812e56

Please sign in to comment.