-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #701 from yalesites-org/YSP-551-reusable-block-error
YSP-551: Toggling a block as reusable on a page leads to white screen error page
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
patches/layout_builder/1330eff91b1234979cf697a66a48e34eb116b441-1.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From f046b109bdaa308f3063980026c0b63227469012 Mon Sep 17 00:00:00 2001 | ||
From: David Blankenship <[email protected]> | ||
Date: Mon, 29 Jul 2024 11:15:16 -0400 | ||
Subject: [PATCH] apply saved | ||
|
||
--- | ||
.../layout_builder/src/Form/ConfigureBlockFormBase.php | 10 +++++++++- | ||
1 file changed, 9 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php b/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php | ||
index 8dd6333269..16b0a8cd70 100644 | ||
--- a/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php | ||
+++ b/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php | ||
@@ -365,7 +365,15 @@ public function submitForm(array &$form, FormStateInterface $form_state) { | ||
$block_content = $form['settings']['block_form']['#block']; | ||
$block_content->setReusable(); | ||
$block_content->setInfo($block_info); | ||
- $block_content->save(); | ||
+ $saved = $block_content->save(); | ||
+ | ||
+ // If it didn't save, it's probably because we're using the same cloned | ||
+ // item somewhere else with different revisions. So, we'll create a new | ||
+ // block_content item to make sure it's fresh and won't interfere. | ||
+ if (!$saved) { | ||
+ $block_content = $block_content->createDuplicate(); | ||
+ $block_content->save(); | ||
+ } | ||
|
||
$block_label_display = $form_state->getValue('settings')['label_display']; | ||
$this->block = $this->blockManager->createInstance('block_content:' . $block_content->uuid(), [ | ||
-- | ||
2.45.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters