You are here

public function ToolbarMenuElement::getDisplayLabel in Toolbar Menu 8

Same name and namespace in other branches
  1. 8.2 src/Entity/ToolbarMenuElement.php \Drupal\toolbar_menu\Entity\ToolbarMenuElement::getDisplayLabel()

Get the displayed label.

If rewrite_label property is set to TRUE, the label of this entity was returned.

Return value

mixed|null|string Display label

File

src/Entity/ToolbarMenuElement.php, line 106

Class

ToolbarMenuElement
Defines the Toolbar element entity.

Namespace

Drupal\toolbar_menu\Entity

Code

public function getDisplayLabel() {
  if ($this
    ->rewriteLabel() && $this
    ->menu()) {
    return $this
      ->loadMenu()
      ->label();
  }
  return $this
    ->label();
}