From a7c16eb8ad212d04580bf6608d21a4f611a4d64c Mon Sep 17 00:00:00 2001 From: Andy Carter Date: Thu, 4 Feb 2016 23:31:44 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Added=20ability=20to=20override=20controlle?= =?UTF-8?q?r=20action=20links=E2=80=99=20text=20using=20`label`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Listener/ViewListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index faeca6e6..3e3e632d 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -375,15 +375,17 @@ protected function _getControllerActions() $scope = isset($config['scope']) ? $config['scope'] : 'entity'; $method = isset($config['method']) ? $config['method'] : 'GET'; + $title = !empty($config['label']) ? $config['label'] : Inflector::humanize(Inflector::underscore($actionName)); + ${$scope}[$actionName] = [ - 'title' => Inflector::humanize(Inflector::underscore($actionName)), + 'title' => $title, 'url' => [ 'action' => $actionName ], 'method' => $method, 'options' => array_diff_key( $config, - array_flip(['method', 'scope', 'className']) + array_flip(['method', 'scope', 'className', 'label']) ) ]; if (!empty($config['callback'])) { From 58b2bd9b3b83023227baa639e333de7b75cb6a50 Mon Sep 17 00:00:00 2001 From: Andy Carter Date: Tue, 23 Feb 2016 18:41:11 +0000 Subject: [PATCH 2/2] Changed `label` to `link_title` Changed option name as suggested by @josegonzalez. --- 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 3e3e632d..541318e2 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -375,7 +375,7 @@ protected function _getControllerActions() $scope = isset($config['scope']) ? $config['scope'] : 'entity'; $method = isset($config['method']) ? $config['method'] : 'GET'; - $title = !empty($config['label']) ? $config['label'] : Inflector::humanize(Inflector::underscore($actionName)); + $title = !empty($config['link_title']) ? $config['link_title'] : Inflector::humanize(Inflector::underscore($actionName)); ${$scope}[$actionName] = [ 'title' => $title, @@ -385,7 +385,7 @@ protected function _getControllerActions() 'method' => $method, 'options' => array_diff_key( $config, - array_flip(['method', 'scope', 'className', 'label']) + array_flip(['method', 'scope', 'className', 'link_title']) ) ]; if (!empty($config['callback'])) {