function DbUpdateController::helpfulLinks

Same name in other branches
  1. 9 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::helpfulLinks()
  2. 8.9.x core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::helpfulLinks()
  3. 11.x 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 694

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.