You are here

function menu_ui_help in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/menu_ui.module \menu_ui_help()
  2. 9 core/modules/menu_ui/menu_ui.module \menu_ui_help()

Implements hook_help().

File

core/modules/menu_ui/menu_ui.module, line 28
Allows administrators to customize the site's navigation menus.

Code

function menu_ui_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.menu_ui':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Menu UI module provides an interface for managing menus. A menu is a hierarchical collection of links, which can be within or external to the site, generally used for navigation. For more information, see the <a href=":menu">online documentation for the Menu UI module</a>.', [
        ':menu' => 'https://www.drupal.org/documentation/modules/menu/',
      ]) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Managing menus') . '</dt>';
      $output .= '<dd>' . t('Users with the <em>Administer menus and menu links</em> permission can add, edit, and delete custom menus on the <a href=":menu">Menus page</a>. Custom menus can be special site menus, menus of external links, or any combination of internal and external links. You may create an unlimited number of additional menus, each of which will automatically have an associated block (if you have the <a href=":block_help">Block module</a> installed). By selecting <em>Edit menu</em>, you can add, edit, or delete links for a given menu. The links listing page provides a drag-and-drop interface for controlling the order of links, and creating a hierarchy within the menu.', [
        ':block_help' => \Drupal::moduleHandler()
          ->moduleExists('block') ? Url::fromRoute('help.page', [
          'name' => 'block',
        ])
          ->toString() : '#',
        ':menu' => Url::fromRoute('entity.menu.collection')
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Displaying menus') . '</dt>';
      $output .= '<dd>' . t('If you have the Block module enabled, then each menu that you create is rendered in a block that you enable and position on the <a href=":blocks">Block layout page</a>. In some <a href=":themes">themes</a>, the main menu and possibly the secondary menu will be output automatically; you may be able to disable this behavior on the <a href=":themes">theme\'s settings page</a>.', [
        ':blocks' => \Drupal::moduleHandler()
          ->moduleExists('block') ? Url::fromRoute('block.admin_display')
          ->toString() : '#',
        ':themes' => Url::fromRoute('system.themes_page')
          ->toString(),
        ':theme_settings' => Url::fromRoute('system.theme_settings')
          ->toString(),
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
  }
  if ($route_name == 'entity.menu.add_form' && \Drupal::moduleHandler()
    ->moduleExists('block') && \Drupal::currentUser()
    ->hasPermission('administer blocks')) {
    return '<p>' . t('You can enable the newly-created block for this menu on the <a href=":blocks">Block layout page</a>.', [
      ':blocks' => Url::fromRoute('block.admin_display')
        ->toString(),
    ]) . '</p>';
  }
  elseif ($route_name == 'entity.menu.collection' && \Drupal::moduleHandler()
    ->moduleExists('block') && \Drupal::currentUser()
    ->hasPermission('administer blocks')) {
    return '<p>' . t('Each menu has a corresponding block that is managed on the <a href=":blocks">Block layout page</a>.', [
      ':blocks' => Url::fromRoute('block.admin_display')
        ->toString(),
    ]) . '</p>';
  }
}