You are here

protected function MenuBlock::getMenuTitle in Menu Block 8

Gets the label of the configured menu.

Return value

string|null Menu label or NULL if no menu exists.

1 call to MenuBlock::getMenuTitle()
MenuBlock::getBlockLabel in src/Plugin/Block/MenuBlock.php
Gets the configured block label.

File

src/Plugin/Block/MenuBlock.php, line 424

Class

MenuBlock
Provides an extended Menu block.

Namespace

Drupal\menu_block\Plugin\Block

Code

protected function getMenuTitle() {
  try {
    $menu = $this->entityTypeManager
      ->getStorage('menu')
      ->load($this
      ->getDerivativeId());
  } catch (\Exception $e) {
    return NULL;
  }
  return $menu ? $menu
    ->label() : NULL;
}