diff --git a/core/modules/help/help.module b/core/modules/help/help.module index 9c86f45..05df538 100644 --- a/core/modules/help/help.module +++ b/core/modules/help/help.module @@ -65,3 +65,35 @@ function help_preprocess_block(&$variables) { $variables['attributes']['role'] = 'complementary'; } } + +/** + * Implements hook_theme(). + */ +function help_theme() { + return array( + 'help_list' => array( + 'variables' => array('links' => array()), + ), + ); +} + +/** + * Returns HTML for a list of help items. + * + * @param $variables + * An associative array containing: + * - links: A list of links to render. + */ +function theme_help_list($variables) { + $links = $variables['links']; + drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); + $output = '

' . t('Help topics') . '

' . t('Help is available on the following items:') . '

'; + // Output pretty four-column list. + $count = count($links); + $limit = ceil($count / 4); + $chunk = array_chunk($links, $limit, TRUE); + foreach ($chunk as $item => $list) { + $output .= theme('item_list', array('items' => $list, 'attributes' => array('class' => 'help-items'))); + } + return $output; +} diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php index e41e6d5..e66630d 100644 --- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php +++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php @@ -14,7 +14,7 @@ /** * Controller routines for help routes. */ -class HelpController implements ContainerInjectionInterface { +class HelpController implements ControllerInterface { /** * Stores the module handler. @@ -43,8 +43,8 @@ public static function create(ContainerInterface $container) { /** * Prints a page listing a glossary of Drupal terminology. * - * @return string - * An HTML string representing the contents of help page. + * @return array + * An array as expected by drupal_render(). */ public function helpMain() { $output = array( @@ -69,7 +69,7 @@ protected function helpLinksAsList() { $modules = array(); foreach ($this->moduleHandler->getImplementations('help') as $module) { if ($this->moduleHandler->invoke($module, 'help', array("admin/help#$module", $empty_arg))) { - $modules[$module] = $module_info[$module]->info['name']; + $modules[$module] = l($module_info[$module]->info['name'], 'admin/help/' . $module); } } asort($modules);