diff --git a/core/modules/help/help.admin.inc b/core/modules/help/help.admin.inc index a3bea9e..ae61032 100644 --- a/core/modules/help/help.admin.inc +++ b/core/modules/help/help.admin.inc @@ -18,42 +18,6 @@ function help_main() { } /** - * Page callback: Prints a page listing general help for a module. - * - * @param $name - * A module name to display a help page for. - * - * @see help_menu() - */ -function help_page($name) { - $output = ''; - if (module_hook($name, 'help')) { - $info = system_get_info('module'); - drupal_set_title($info[$name]['name']); - - $temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg()); - if (empty($temp)) { - $output .= t("No help is available for module %module.", array('%module' => $info[$name]['name'])); - } - else { - $output .= $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) { - $links[] = l($task['title'], $task['link_path'], $task['localized_options']); - } - $output .= theme('item_list', array('items' => $links, 'title' => t('@module administration pages', array('@module' => $info[$name]['name'])))); - } - } - return $output; -} - -/** * Provides a formatted list of available help topics. * * @return diff --git a/core/modules/help/help.module b/core/modules/help/help.module index aac8636..a6b3c95 100644 --- a/core/modules/help/help.module +++ b/core/modules/help/help.module @@ -23,11 +23,8 @@ function help_menu() { foreach ($modules as $module) { $items['admin/help/' . $module] = array( 'title' => $module, - 'page callback' => 'help_page', - 'page arguments' => array(2), - 'access arguments' => array('access administration pages'), + 'route_name' => 'help_page', 'type' => MENU_VISIBLE_IN_BREADCRUMB, - 'file' => 'help.admin.inc', ); } diff --git a/core/modules/help/help.routing.yml b/core/modules/help/help.routing.yml new file mode 100644 index 0000000..f1b0b21 --- /dev/null +++ b/core/modules/help/help.routing.yml @@ -0,0 +1,6 @@ +help_page: + pattern: 'admin/help/{name}' + defaults: + _content: '\Drupal\help\Controller\HelpController::helpPage' + requirements: + _permission: 'access administration pages' diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php new file mode 100644 index 0000000..065eb94 --- /dev/null +++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php @@ -0,0 +1,67 @@ + $info[$name]['name'])); + } + else { + $output .= $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) { + $links[] = l($task['title'], $task['link_path'], $task['localized_options']); + } + $output .= theme('item_list', array('items' => $links, 'title' => t('@module administration pages', array('@module' => $info[$name]['name'])))); + } + } + return $output; + } + +} +?>