From 941ecd8f0f510a26aada5ba5eea726541c309dbf Mon Sep 17 00:00:00 2001 From: Thomas Templeton Date: Thu, 21 Jul 2022 17:47:15 +1000 Subject: [PATCH] Fix child blocks UI element not showing on FLD sidebar on existing block types --- CHANGELOG.md | 1 + src/controllers/Configurator.php | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f64cee..8f7d180a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Fixed a JavaScript error that occurred when pasting a block type - Fixed an incorrect German translation of 'Min Blocks' (thanks @alumpe) +- Fixed a bug where the child blocks UI element wasn't appearing on the field layout designer sidebar on existing block types ## 3.1.8 - 2022-07-15 diff --git a/src/controllers/Configurator.php b/src/controllers/Configurator.php index 397207aa..17357553 100644 --- a/src/controllers/Configurator.php +++ b/src/controllers/Configurator.php @@ -33,9 +33,13 @@ public function actionRenderFieldLayout(): Response $config = $request->getBodyParam('layout'); // Prioritise the config - $fieldLayout = $config - ? FieldLayout::createFromConfig($config) - : ($id ? Craft::$app->getFields()->getLayoutById($id) : new FieldLayout(['type' => Block::class])); + if ($config) { + $fieldLayout = FieldLayout::createFromConfig($config); + $fieldLayout->type = Block::class; + } else { + $fieldLayout = $id ? Craft::$app->getFields()->getLayoutById($id) : new FieldLayout(['type' => Block::class]); + } + $html = Neo::$plugin->blockTypes->renderFieldLayoutDesigner($fieldLayout); return $this->asJson([