Skip to content

Commit

Permalink
Merge pull request #240 from FriendsOfCake/action-links-config
Browse files Browse the repository at this point in the history
Action links config
  • Loading branch information
ADmad authored Apr 6, 2018
2 parents 771f3a4 + 364a991 commit 6407198
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Listener/ViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,13 @@ protected function _getControllerActionConfiguration($actionName, $config)
$action = $this->_action($realAction);
$class = get_class($action);
$class = substr($class, strrpos($class, '\\') + 1);
$config['scope'] = $action->scope();

if ($class === 'DeleteAction') {
$config['method'] = 'DELETE';
$config += ['method' => 'DELETE'];
}

if ($class === 'AddAction') {
$config['scope'] = 'table';
if (!isset($config['scope'])) {
$config['scope'] = $class === 'AddAction' ? 'table' : $action->scope();
}
}

Expand All @@ -448,7 +447,7 @@ protected function _getControllerActionConfiguration($actionName, $config)
'method' => $method,
'options' => array_diff_key(
$config,
array_flip(['method', 'scope', 'className', 'link_title', 'messages', 'url', 'scaffold'])
array_flip(['method', 'scope', 'link_title', 'url', 'scaffold', 'callback'])
)
];
if (!empty($config['callback'])) {
Expand All @@ -467,7 +466,7 @@ protected function _getAllowedActions()
{
$actions = $this->_action()->getConfig('scaffold.actions');
if ($actions === null) {
$actions = $this->_crud()->getConfig('actions');
$actions = array_keys($this->_crud()->getConfig('actions'));
}

$extraActions = $this->_action()->getConfig('scaffold.extra_actions') ?: [];
Expand Down

0 comments on commit 6407198

Please sign in to comment.