Skip to content

Commit

Permalink
Merge pull request #107 from drmonkeyninja/controller_actions
Browse files Browse the repository at this point in the history
Added ability to override controller action links’ text using `label`.
  • Loading branch information
josegonzalez committed Apr 28, 2016
2 parents 7ff2418 + 58b2bd9 commit 8f33bd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Listener/ViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,17 @@ protected function _getControllerActions()
$scope = isset($config['scope']) ? $config['scope'] : 'entity';
$method = isset($config['method']) ? $config['method'] : 'GET';

$title = !empty($config['link_title']) ? $config['link_title'] : 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', 'link_title'])
)
];
if (!empty($config['callback'])) {
Expand Down

0 comments on commit 8f33bd9

Please sign in to comment.