3 namespace Drupal\system\Controller;
5 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
6 use Symfony\Component\DependencyInjection\ContainerInterface;
7 use Symfony\Component\HttpFoundation\Request;
8 use Symfony\Component\HttpFoundation\Response;
9 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
12 * Controller routines for batch routes.
14 class BatchController implements ContainerInjectionInterface {
24 * Constructs a new BatchController.
29 public function __construct($root) {
36 public static function create(ContainerInterface $container) {
38 $container->get('app.root')
43 * Returns a system batch page.
45 * @param \Symfony\Component\HttpFoundation\Request $request
46 * The current request object.
48 * @return \Symfony\Component\HttpFoundation\Response|array
49 * A \Symfony\Component\HttpFoundation\Response object or render array.
51 * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
53 public function batchPage(Request $request) {
54 require_once $this->root . '/core/includes/batch.inc';
55 $output = _batch_page($request);
57 if ($output === FALSE) {
58 throw new AccessDeniedHttpException();
60 elseif ($output instanceof Response) {
63 elseif (isset($output)) {
66 '#show_messages' => FALSE,
74 * The _title_callback for the system.batch_page.normal route.
79 public function batchPageTitle() {
80 $current_set = _batch_current_set();
81 return !empty($current_set['title']) ? $current_set['title'] : '';