You are here

public function AddMenuOverride::title in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 modules/entity_hierarchy_microsite/src/Controller/AddMenuOverride.php \Drupal\entity_hierarchy_microsite\Controller\AddMenuOverride::title()

Title callback for adding a new override.

Parameters

string $target: Target UUID.

Return value

string Title.

1 string reference to 'AddMenuOverride::title'
entity_hierarchy_microsite.routing.yml in modules/entity_hierarchy_microsite/entity_hierarchy_microsite.routing.yml
modules/entity_hierarchy_microsite/entity_hierarchy_microsite.routing.yml

File

modules/entity_hierarchy_microsite/src/Controller/AddMenuOverride.php, line 108

Class

AddMenuOverride
Defines a class for a controller for adding a menu overrride.

Namespace

Drupal\entity_hierarchy_microsite\Controller

Code

public function title(string $target) {
  $plugin_id = 'entity_hierarchy_microsite:' . $target;
  if (!$this->menuLinkManager
    ->hasDefinition($plugin_id)) {
    return '';
  }

  /** @var \Drupal\entity_hierarchy_microsite\Plugin\Menu\MicrositeMenuItem $instance */
  $instance = $this->menuLinkManager
    ->createInstance($plugin_id);
  return new TranslatableMarkup('Add an override for @label', [
    '@label' => $instance
      ->getTitle(),
  ]);
}