public function MenuPositionLink::getTitle in Menu Position 8
Returns the localized title to be shown for this link.
Return value
string The title of the menu link.
Overrides MenuLinkInterface::getTitle
File
- src/
Plugin/ Menu/ MenuPositionLink.php, line 147
Class
- MenuPositionLink
- Defines menu links provided by menu position rules.
Namespace
Drupal\menu_position\Plugin\MenuCode
public function getTitle() {
// When we're in an admin route we want to display the name of the menu
// position rule.
// @todo Ensure this translates properly when using configuration
// translation.
if ($this->adminContext
->isAdminRoute()) {
return $this->pluginDefinition['title'];
}
else {
$title = $this->titleResolver
->getTitle($this->requestStack
->getCurrentRequest(), $this->routeMatch
->getRouteObject());
if (is_array($title)) {
$title = $this->renderer
->renderPlain($title);
}
return $title;
}
}