Skip to content

Commit

Permalink
feat: do not display the Delete button on anything but the EditAction
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed May 12, 2018
1 parent e101690 commit eb124cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/_partials/pages/form/submit-buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ By default, extra buttons appear on the right-hand side of forms. The left-hand
is managed separately, and will show the following by default

- Delete: An embedded postLink for deleting the current entity. This only appears on the
pages that are not rendered via ``AddAction``.
pages that are rendered via ``EditAction``.


To use the defaults, you may either omit the configuration key **or** set it
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/Traits/FormTypeTrait.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace CrudView\Listener\Traits;

use Crud\Action\AddAction;
use Crud\Action\EditAction;

trait FormTypeTrait
{
Expand Down Expand Up @@ -127,7 +127,7 @@ protected function _getDefaultExtraLeftButtons()
$buttons = [];

$action = $this->_action();
if (!($action instanceof AddAction)) {
if ($action instanceof EditAction) {
$buttons[] = [
'title' => __d('crud', 'Delete'),
'url' => ['action' => 'delete'],
Expand Down

0 comments on commit eb124cc

Please sign in to comment.