You are here

public function DbUpdateController::requirements in Drupal 8

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

Renders a list of requirement errors or warnings.

Parameters

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

Return value

array A render array.

1 call to DbUpdateController::requirements()
DbUpdateController::handle in core/modules/system/src/Controller/DbUpdateController.php
Returns a database update page.

File

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

Class

DbUpdateController
Controller routines for database update routes.

Namespace

Drupal\system\Controller

Code

public function requirements($severity, array $requirements, Request $request) {
  $options = $severity == REQUIREMENT_WARNING ? [
    'continue' => 1,
  ] : [];

  // @todo Revisit once https://www.drupal.org/node/2548095 is in. Something
  // like Url::fromRoute('system.db_update')->setOptions() should then be
  // possible.
  $try_again_url = Url::fromUri($request
    ->getUriForPath(''))
    ->setOptions([
    'query' => $options,
  ])
    ->toString(TRUE)
    ->getGeneratedUrl();
  $build['status_report'] = [
    '#type' => 'status_report',
    '#requirements' => $requirements,
    '#suffix' => $this
      ->t('Check the messages and <a href=":url">try again</a>.', [
      ':url' => $try_again_url,
    ]),
  ];
  $build['#title'] = $this
    ->t('Requirements problem');
  return $build;
}