public HelpController::helpPage($name)
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().
Throws
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
File
- core/modules/help/src/Controller/HelpController.php, line 114
Class
- HelpController
- Controller routines for help routes.
Namespace
Drupal\help\Controller
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | public function helpPage( $name ) { $build = array (); if ( $this ->moduleHandler()->implementsHook( $name , 'help' )) { $module_name = $this ->moduleHandler()->getName( $name ); $build [ '#title' ] = $module_name ; $info = system_get_info( 'module' , $name ); if ( $info [ 'package' ] === 'Core (Experimental)' ) { drupal_set_message( $this ->t( 'This module is experimental. <a href=":url">Experimental modules</a> are provided for testing purposes only. Use at your own risk.' , [ ':url' => 'https://www.drupal.org/core/experimental' ]), 'warning' ); } $temp = $this ->moduleHandler()->invoke( $name , 'help' , array ( "help.page.$name" , $this ->routeMatch)); if ( empty ( $temp )) { $build [ 'top' ] = [ '#markup' => $this ->t( 'No help is available for module %module.' , array ( '%module' => $module_name ))]; } else { if (! is_array ( $temp )) { $temp = [ '#markup' => $temp ]; } $build [ 'top' ] = $temp ; } // Only print list of administration pages if the module in question has // any such pages associated with it. $admin_tasks = system_get_module_admin_tasks( $name , system_get_info( 'module' , $name )); if (! empty ( $admin_tasks )) { $links = array (); foreach ( $admin_tasks as $task ) { $link [ 'url' ] = $task [ 'url' ]; $link [ 'title' ] = $task [ 'title' ]; $links [] = $link ; } $build [ 'links' ] = array ( '#theme' => 'links__help' , '#heading' => array ( 'level' => 'h3' , 'text' => $this ->t( '@module administration pages' , array ( '@module' => $module_name )), ), '#links' => $links , ); } return $build ; } else { throw new NotFoundHttpException(); } } |
Please login to continue.