diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index a4b0350..54fba33 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -16,6 +16,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Request; /** * Defines the block list controller. @@ -37,6 +38,13 @@ class BlockListController extends ConfigEntityListController implements FormInte protected $theme; /** + * The current request. + * + * @var \Symfony\Component\HttpFoundation\Request + */ + protected $request; + + /** * The block manager. * * @var \Drupal\Component\Plugin\PluginManagerInterface @@ -98,8 +106,15 @@ public function load() { /** * Overrides \Drupal\Core\Entity\EntityListController::render(). + * + * @param string|null $theme + * (optional) The theme to dislay the blocks for. If NULL, the current theme + * will be used. + * @param \Symfony\Component\HttpFoundation\Request $request + * The current request. */ - public function render($theme = NULL) { + public function render($theme = NULL, Request $request = NULL) { + $this->request = $request; // If no theme was specified, use the current theme. $this->theme = $theme ?: $GLOBALS['theme_key']; @@ -119,10 +134,9 @@ public function getFormID() { * Form constructor for the main block administration form. */ public function buildForm(array $form, array &$form_state) { - $request = \Drupal::request(); $placement = FALSE; - if ($request->query->has('block-placement')) { - $placement = $request->query->get('block-placement'); + if ($this->request->query->has('block-placement')) { + $placement = $this->request->query->get('block-placement'); $form['#attached']['js'][] = array( 'type' => 'setting', 'data' => array('blockPlacement' => $placement),