public SystemController::overview($link_id)
Provide the administration overview page.
Parameters
string $link_id: The ID of the administrative path link for which to display child links.
Return value
array A renderable array of the administration overview page.
File
- core/modules/system/src/Controller/SystemController.php, line 112
Class
- SystemController
- Returns responses for System routes.
Namespace
Drupal\system\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 48 49 50 51 52 53 54 | public function overview( $link_id ) { // Check for status report errors. if ( $this ->systemManager->checkRequirements() && $this ->currentUser()->hasPermission( 'administer site configuration' )) { drupal_set_message( $this ->t( 'One or more problems were detected with your Drupal installation. Check the <a href=":status">status report</a> for more information.' , array ( ':status' => $this ->url( 'system.status' ))), 'error' ); } // Load all menu links below it. $parameters = new MenuTreeParameters(); $parameters ->setRoot( $link_id )->excludeRoot()->setTopLevelOnly()->onlyEnabledLinks(); $tree = $this ->menuLinkTree->load(NULL, $parameters ); $manipulators = array ( array ( 'callable' => 'menu.default_tree_manipulators:checkAccess' ), array ( 'callable' => 'menu.default_tree_manipulators:generateIndexAndSort' ), ); $tree = $this ->menuLinkTree->transform( $tree , $manipulators ); $tree_access_cacheability = new CacheableMetadata(); $blocks = array (); foreach ( $tree as $key => $element ) { $tree_access_cacheability = $tree_access_cacheability ->merge(CacheableMetadata::createFromObject( $element ->access)); // Only render accessible links. if (! $element ->access->isAllowed()) { continue ; } $link = $element ->link; $block [ 'title' ] = $link ->getTitle(); $block [ 'description' ] = $link ->getDescription(); $block [ 'content' ] = array ( '#theme' => 'admin_block_content' , '#content' => $this ->systemManager->getAdminBlock( $link ), ); if (! empty ( $block [ 'content' ][ '#content' ])) { $blocks [ $key ] = $block ; } } if ( $blocks ) { ksort( $blocks ); $build = [ '#theme' => 'admin_page' , '#blocks' => $blocks , ]; $tree_access_cacheability ->applyTo( $build ); return $build ; } else { $build = [ '#markup' => $this ->t( 'You do not have any administrative items.' ), ]; $tree_access_cacheability ->applyTo( $build ); return $build ; } } |
Please login to continue.