From fcb24f94c6737f32b024046c521fe0c335378ad5 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Tue, 13 Aug 2013 07:33:54 +0100 Subject: [PATCH] Issue #1618458 by Cottser, Jody Lynn, grndlvl: Fixed help_menu() creates unnecessary router items. --- core/modules/help/help.module | 13 ++++--------- .../lib/Drupal/help/Controller/HelpController.php | 9 +++++++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/modules/help/help.module b/core/modules/help/help.module index 36821c0afc07..9c86f4592376 100644 --- a/core/modules/help/help.module +++ b/core/modules/help/help.module @@ -16,15 +16,10 @@ function help_menu() { 'weight' => 9, ); - $modules = Drupal::moduleHandler()->getImplementations('help'); - ksort($modules); - foreach ($modules as $module) { - $items['admin/help/' . $module] = array( - 'title' => $module, - 'route_name' => 'help_page', - 'type' => MENU_VISIBLE_IN_BREADCRUMB, - ); - } + $items['admin/help/%'] = array( + 'route_name' => 'help_page', + 'type' => MENU_VISIBLE_IN_BREADCRUMB, + ); return $items; } diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php index 8bea58c6ec29..9fb23a939acf 100644 --- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php +++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php @@ -9,6 +9,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Controller routines for help routes. @@ -98,6 +99,8 @@ protected function helpLinksAsList() { * * @return array * A render array as expected by drupal_render(). + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function helpPage($name) { $build = array(); @@ -132,9 +135,11 @@ public function helpPage($name) { '#links' => $links, ); } + return $build; + } + else { + throw new NotFoundHttpException(); } - - return $build; } } -- GitLab