diff --git a/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskBase.php b/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskBase.php index 274f09b..8a16d4d 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskBase.php +++ b/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskBase.php @@ -81,10 +81,7 @@ public function getRouteName() { } /** - * Returns the localized title to be shown for this tab. - * - * Subclasses may add arguments for request attributes which will then be - * automatically supplied by the controller resolver. + * {@inheritdoc} */ public function getTitle() { // Subclasses may pull in the request or specific attributes as parameters. @@ -92,10 +89,7 @@ public function getTitle() { } /** - * Returns an internal Drupal path to use when creating the link for the tab. - * - * Subclasses may add arguments for request attributes which will then be - * automatically supplied by the controller resolver. + * {@inheritdoc} */ public function getPath() { // Subclasses may set a request into the generator or use any desired method diff --git a/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskInterface.php b/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskInterface.php index 0db9b1f..28aa3c4 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskInterface.php +++ b/core/modules/system/lib/Drupal/system/Plugin/MenuLocalTaskInterface.php @@ -21,6 +21,22 @@ public function getRouteName(); /** + * Returns the localized title to be shown for this tab. + * + * Subclasses may add optional arguments like NodeInterface $node = NULL that + * will be supplied by the ControllerResolver. + */ + public function getTitle(); + + /** + * Returns an internal Drupal path to use when creating the link for the tab. + * + * Subclasses may add optional arguments like NodeInterface $node = NULL that + * will be supplied by the ControllerResolver. + */ + public function getPath(); + + /** * Returns the weight of the local task. * * @return int|null diff --git a/core/modules/system/lib/Drupal/system/Plugin/Type/MenuLocalTaskManager.php b/core/modules/system/lib/Drupal/system/Plugin/Type/MenuLocalTaskManager.php index 6f3e247..86fea20 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Type/MenuLocalTaskManager.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Type/MenuLocalTaskManager.php @@ -84,11 +84,8 @@ public function __construct(\Traversable $namespaces, ControllerResolverInterfac */ public function getTitle(MenuLocalTaskInterface $local_task) { $controller = array($local_task, 'getTitle'); - if (is_callable($controller)) { - $arguments = $this->controllerResolver->getArguments($this->request, $controller); - return call_user_func_array($controller, $arguments); - } - throw new \BadMethodCallException('Menu local task plugins must implement a getTitle() method.'); + $arguments = $this->controllerResolver->getArguments($this->request, $controller); + return call_user_func_array($controller, $arguments); } /** @@ -102,11 +99,8 @@ public function getTitle(MenuLocalTaskInterface $local_task) { */ public function getPath(MenuLocalTaskInterface $local_task) { $controller = array($local_task, 'getPath'); - if (is_callable($controller)) { - $arguments = $this->controllerResolver->getArguments($this->request, $controller); - return call_user_func_array($controller, $arguments); - } - throw new \BadMethodCallException('Menu local task plugins must implement a getPath() method.'); + $arguments = $this->controllerResolver->getArguments($this->request, $controller); + return call_user_func_array($controller, $arguments); } /**