Issue #1618458 by Cottser, Jody Lynn, grndlvl: Fixed help_menu() creates unnecessary router items.

8.0.x
Nathaniel Catchpole 2013-08-13 07:33:54 +01:00
parent 21d59b5009
commit fcb24f94c6
2 changed files with 11 additions and 11 deletions

View File

@ -16,15 +16,10 @@ function help_menu() {
'weight' => 9, 'weight' => 9,
); );
$modules = Drupal::moduleHandler()->getImplementations('help'); $items['admin/help/%'] = array(
ksort($modules);
foreach ($modules as $module) {
$items['admin/help/' . $module] = array(
'title' => $module,
'route_name' => 'help_page', 'route_name' => 'help_page',
'type' => MENU_VISIBLE_IN_BREADCRUMB, 'type' => MENU_VISIBLE_IN_BREADCRUMB,
); );
}
return $items; return $items;
} }

View File

@ -9,6 +9,7 @@ namespace Drupal\help\Controller;
use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* Controller routines for help routes. * Controller routines for help routes.
@ -98,6 +99,8 @@ class HelpController implements ControllerInterface {
* *
* @return array * @return array
* A render array as expected by drupal_render(). * A render array as expected by drupal_render().
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public function helpPage($name) { public function helpPage($name) {
$build = array(); $build = array();
@ -132,9 +135,11 @@ class HelpController implements ControllerInterface {
'#links' => $links, '#links' => $links,
); );
} }
}
return $build; return $build;
} }
else {
throw new NotFoundHttpException();
}
}
} }