function MenuLinkContentHooks::help

Implements hook_help().

Attributes

#[Hook('help')]

File

core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php, line 23

Class

MenuLinkContentHooks
Hook implementations for menu_link_content.

Namespace

Drupal\menu_link_content\Hook

Code

public function help($route_name, RouteMatchInterface $route_match) : ?string {
  switch ($route_name) {
    case 'help.page.menu_link_content':
      $output = '';
      $output .= '<h2>' . $this->t('About') . '</h2>';
      $output .= '<p>' . $this->t('The Custom Menu Links module allows users to create menu links. These links can be translated if multiple languages are used for the site.');
      if (\Drupal::moduleHandler()->moduleExists('menu_ui')) {
        $output .= ' ' . $this->t('It is required by the Menu UI module, which provides an interface for managing menus and menu links. For more information, see the <a href=":menu-help">Menu UI module help page</a> and the <a href=":drupal-org-help">online documentation for the Custom Menu Links module</a>.', [
          ':menu-help' => Url::fromRoute('help.page', [
            'name' => 'menu_ui',
          ])->toString(),
          ':drupal-org-help' => 'https://www.drupal.org/documentation/modules/menu_link',
        ]);
      }
      else {
        $output .= ' ' . $this->t('For more information, see the <a href=":drupal-org-help">online documentation for the Custom Menu Links module</a>. If you install the Menu UI module, it provides an interface for managing menus and menu links.', [
          ':drupal-org-help' => 'https://www.drupal.org/documentation/modules/menu_link',
        ]);
      }
      $output .= '</p>';
      return $output;
  }
  return NULL;
}

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