function NavigationHooks::help

Implements hook_help().

Attributes

#[Hook('help')] #[RemoveHook('help', class: LayoutBuilderHooks::class, method: 'help')]

File

core/modules/navigation/src/Hook/NavigationHooks.php, line 57

Class

NavigationHooks
Hook implementations for navigation.

Namespace

Drupal\navigation\Hook

Code

public function help($route_name, RouteMatchInterface $route_match) : ?string {
  switch ($route_name) {
    case 'help.page.navigation':
      $output = '';
      $output .= '<h3>' . $this->t('About') . '</h3>';
      $output .= '<p>' . $this->t('The Navigation module provides a left-aligned, collapsible, vertical sidebar navigation.') . '</p>';
      $output .= '<p>' . $this->t('For more information, see the <a href=":docs">online documentation for the Navigation module</a>.', [
        ':docs' => 'https://www.drupal.org/docs/develop/core-modules-and-themes/core-modules/navigation-module',
      ]) . '</p>';
      return $output;
  }
  $configuration_route = 'layout_builder.navigation.';
  if (!$route_match->getRouteObject()
    ->getOption('_layout_builder') || !str_starts_with($route_name, $configuration_route)) {
    return $this->moduleHandler
      ->invoke('layout_builder', 'help', [
      $route_name,
      $route_match,
    ]);
  }
  if (str_starts_with($route_name, $configuration_route)) {
    $output = '<p>' . $this->t('This layout builder tool allows you to configure the blocks in the navigation toolbar.') . '</p>';
    $output .= '<p>' . $this->t('Forms and links inside the content of the layout builder tool are disabled in Edit mode.') . '</p>';
    return $output;
  }
  return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.