You are here

public function HookHelpSection::listTopics in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/help/src/Plugin/HelpSection/HookHelpSection.php \Drupal\help\Plugin\HelpSection\HookHelpSection::listTopics()

Returns a list of topics to show in the help section.

Return value

array A sorted list of topic links or render arrays for topic links. The links will be shown in the help section; if the returned array of links is empty, the section will be shown with some generic empty text.

Overrides HelpSectionPluginInterface::listTopics

File

core/modules/help/src/Plugin/HelpSection/HookHelpSection.php, line 60

Class

HookHelpSection
Provides the module topics list section for the help page.

Namespace

Drupal\help\Plugin\HelpSection

Code

public function listTopics() {
  $topics = [];
  foreach ($this->moduleHandler
    ->getImplementations('help') as $module) {
    $title = $this->moduleHandler
      ->getName($module);
    $topics[$title] = Link::createFromRoute($title, 'help.page', [
      'name' => $module,
    ]);
  }

  // Sort topics by title, which is the array key above.
  ksort($topics);
  return $topics;
}