Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / layout_builder / src / Controller / ChooseSectionController.php
index a04cdbb1c1169baa827505005121aec1e2e12740..3405692e53bfac1379ff4407c823124970e23bc9 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\layout_builder\Controller;
 
+use Drupal\Core\Ajax\AjaxHelperTrait;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
 use Drupal\Core\Layout\LayoutPluginManagerInterface;
 use Drupal\Core\Plugin\PluginFormInterface;
@@ -61,7 +62,8 @@ class ChooseSectionController implements ContainerInjectionInterface {
     $output['#title'] = $this->t('Choose a layout');
 
     $items = [];
-    foreach ($this->layoutManager->getDefinitions() as $plugin_id => $definition) {
+    $definitions = $this->layoutManager->getFilteredDefinitions('layout_builder', [], ['section_storage' => $section_storage]);
+    foreach ($definitions as $plugin_id => $definition) {
       $layout = $this->layoutManager->createInstance($plugin_id);
       $item = [
         '#type' => 'link',