You are here

protected function DbUpdateController::helpfulLinks in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::helpfulLinks()

Provides links to the homepage and administration pages.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request.

Return value

array An array of links.

2 calls to DbUpdateController::helpfulLinks()
DbUpdateController::results in core/modules/system/src/Controller/DbUpdateController.php
Displays results of the update script with any accompanying errors.
DbUpdateController::selection in core/modules/system/src/Controller/DbUpdateController.php
Renders a list of available database updates.

File

core/modules/system/src/Controller/DbUpdateController.php, line 675

Class

DbUpdateController
Controller routines for database update routes.

Namespace

Drupal\system\Controller

Code

protected function helpfulLinks(Request $request) {

  // @todo Simplify with https://www.drupal.org/node/2548095
  $base_url = str_replace('/update.php', '', $request
    ->getBaseUrl());
  $links['front'] = [
    'title' => $this
      ->t('Front page'),
    'url' => Url::fromRoute('<front>')
      ->setOption('base_url', $base_url),
  ];
  if ($this->account
    ->hasPermission('access administration pages')) {
    $links['admin-pages'] = [
      'title' => $this
        ->t('Administration pages'),
      'url' => Url::fromRoute('system.admin')
        ->setOption('base_url', $base_url),
    ];
  }
  return $links;
}