You are here

public function MenuPosition::summary in Menu Condition 8

Provides a human readable summary of the condition's configuration.

Overrides ConditionInterface::summary

File

src/Plugin/Condition/MenuPosition.php, line 108

Class

MenuPosition
Provides a 'Menu position' condition.

Namespace

Drupal\menu_condition\Plugin\Condition

Code

public function summary() {
  list($menu_name, $link_plugin_id) = explode(':', $this->configuration['menu_parent'], 2);
  if ($link_plugin_id) {
    $menu_link = $this->pluginManagerMenuLink
      ->createInstance($link_plugin_id);
    return $this
      ->t('The menu item @link-title is either active or is in the active trail.', [
      '@link-title' => $menu_link
        ->getTitle(),
    ]);
  }
  else {

    // Summary for when a whole menu was selected.
    return $this
      ->t('The active menu item is in the @menu-name menu.', [
      '@menu-name' => $menu_name,
    ]);
  }
}