From 42aedce060720180610d1c182cf2267908ae6b92 Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 4 Apr 2018 02:40:32 +0530 Subject: [PATCH 1/2] Prevent Action class config ending up as action link attributes. Before this fix keys like "viewVar", "findMethod" etc. set for Action class config, and key "callback" ended up as HTML attributes for action links in templates. --- src/Listener/ViewListener.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index 62763a2f..19ca18da 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -448,7 +448,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'])) { @@ -467,7 +467,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') ?: []; From 364a991c14e1426aefd9bd71689991b5c18680fe Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 4 Apr 2018 03:05:41 +0530 Subject: [PATCH 2/2] Don't overwrite explicitly provided action link config. Before this fix you always ended up with table scope for mapped IndexAction even if you explicitly set scope to entity in action link config. --- src/Listener/ViewListener.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index 19ca18da..581fdd31 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -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(); } }