public function HelpController::helpPage

Prints a page listing general help for a module.

Parameters

string $name: A module name to display a help page for.

Return value

array A render array as expected by drupal_render().

1 string reference to 'HelpController::helpPage'
help.routing.yml in drupal/core/modules/help/help.routing.yml
drupal/core/modules/help/help.routing.yml

File

drupal/core/modules/help/lib/Drupal/help/Controller/HelpController.php, line 102
Contains \Drupal\help\Controller\HelpController.

Class

HelpController
Controller routines for help routes.

Namespace

Drupal\help\Controller

Code

public function helpPage($name) {
  $build = array();
  if ($this->moduleHandler
    ->implementsHook($name, 'help')) {
    $info = system_get_info('module');
    drupal_set_title($info[$name]['name']);
    $temp = $this->moduleHandler
      ->invoke($name, 'help', array(
      "admin/help#{$name}",
      drupal_help_arg(),
    ));
    if (empty($temp)) {
      $build['top']['#markup'] = t('No help is available for module %module.', array(
        '%module' => $info[$name]['name'],
      ));
    }
    else {
      $build['top']['#markup'] = $temp;
    }

    // Only print list of administration pages if the module in question has
    // any such pages associated to it.
    $admin_tasks = system_get_module_admin_tasks($name, $info[$name]);
    if (!empty($admin_tasks)) {
      $links = array();
      foreach ($admin_tasks as $task) {
        $link = $task['localized_options'];
        $link['href'] = $task['link_path'];
        $link['title'] = $task['title'];
        $links[] = $link;
      }
      $build['links']['#links'] = array(
        '#heading' => array(
          'level' => 'h3',
          'text' => t('@module administration pages', array(
            '@module' => $info[$name]['name'],
          )),
        ),
        '#links' => $links,
      );
    }
  }
  return $build;
}