function BatchController::batchPage
Same name and namespace in other branches
- 9 core/modules/system/src/Controller/BatchController.php \Drupal\system\Controller\BatchController::batchPage()
- 8.9.x core/modules/system/src/Controller/BatchController.php \Drupal\system\Controller\BatchController::batchPage()
- 10 core/modules/system/src/Controller/BatchController.php \Drupal\system\Controller\BatchController::batchPage()
Returns a system batch page.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
\Symfony\Component\HttpFoundation\Response|array A \Symfony\Component\HttpFoundation\Response object or render array.
Throws
\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
1 string reference to 'BatchController::batchPage'
- system.routing.yml in core/
modules/ system/ system.routing.yml - core/modules/system/system.routing.yml
File
-
core/
modules/ system/ src/ Controller/ BatchController.php, line 51
Class
- BatchController
- Controller routines for batch routes.
Namespace
Drupal\system\ControllerCode
public function batchPage(Request $request) {
$output = _batch_page($request);
if ($output === FALSE) {
throw new AccessDeniedHttpException();
}
elseif ($output instanceof Response) {
return $output;
}
elseif (isset($output)) {
// Directly render a status message placeholder without any messages.
// Messages are not intended to be show on the batch page, but in the
// event an error in a AJAX callback the messages will be displayed.
// @todo Remove in https://drupal.org/i/3396099.
$output['batch_messages'] = [
'#theme' => 'status_messages',
'#message_list' => [],
'#status_headings' => [
'status' => $this->t('Status message'),
'error' => $this->t('Error message'),
'warning' => $this->t('Warning message'),
],
];
$title = $output['#title'] ?? NULL;
$page = [
'#type' => 'page',
'#title' => $title,
'#show_messages' => FALSE,
'content' => $output,
];
// Also inject title as a page header (if available).
if ($title) {
$page['header'] = [
'#type' => 'page_title',
'#title' => $title,
];
}
return $page;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.