You are here

protected function MenuBlock::getActiveItemTitle in Menu Block 8

Gets the active menu item's title.

Return value

string|null Currently active menu item title or NULL if there's nothing active.

2 calls to MenuBlock::getActiveItemTitle()
MenuBlock::getActiveTrailParentTitle in src/Plugin/Block/MenuBlock.php
Gets the title of the parent of the active menu item.
MenuBlock::getBlockLabel in src/Plugin/Block/MenuBlock.php
Gets the configured block label.

File

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

Class

MenuBlock
Provides an extended Menu block.

Namespace

Drupal\menu_block\Plugin\Block

Code

protected function getActiveItemTitle() {

  /** @var array $active_trail_ids */
  $active_trail_ids = $this
    ->getDerivativeActiveTrailIds();
  if ($active_trail_ids) {
    return $this
      ->getLinkTitleFromLink(reset($active_trail_ids));
  }
}