Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / block / src / Controller / BlockLibraryController.php
index 959c642bbaf4b064598193e7a98f80c3eaa1d238..cf5f20a0baf57e506750dd1cd493d2a33e2243d9 100644 (file)
@@ -101,8 +101,14 @@ class BlockLibraryController extends ControllerBase {
       ['data' => $this->t('Operations')],
     ];
 
+    $region = $request->query->get('region');
+    $weight = $request->query->get('weight');
+
     // Only add blocks which work without any available context.
-    $definitions = $this->blockManager->getDefinitionsForContexts($this->contextRepository->getAvailableContexts());
+    $definitions = $this->blockManager->getFilteredDefinitions('block_ui', $this->contextRepository->getAvailableContexts(), [
+      'theme' => $theme,
+      'region' => $region,
+    ]);
     // Order by category, and then by admin label.
     $definitions = $this->blockManager->getSortedDefinitions($definitions);
     // Filter out definitions that are not intended to be placed by the UI.
@@ -110,8 +116,6 @@ class BlockLibraryController extends ControllerBase {
       return empty($definition['_block_ui_hidden']);
     });
 
-    $region = $request->query->get('region');
-    $weight = $request->query->get('weight');
     $rows = [];
     foreach ($definitions as $plugin_id => $plugin_definition) {
       $row = [];