Skip to content

Instantly share code, notes, and snippets.

@jeffam
Last active December 2, 2019 23:54
Show Gist options
  • Save jeffam/392e7c96351faf36fc084de5e76d6622 to your computer and use it in GitHub Desktop.
Save jeffam/392e7c96351faf36fc084de5e76d6622 to your computer and use it in GitHub Desktop.
Cannot delete or edit a block that is placed in a section of the layout_builder Patch for 8.7
diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme
index 078d2adc80..ee7ffb426b 100644
--- a/core/themes/seven/seven.theme
+++ b/core/themes/seven/seven.theme
@@ -87,10 +87,11 @@ function seven_preprocess_block_content_add_list(&$variables) {
/**
* Implements hook_preprocess_block() for block content.
*
- * Disables contextual links for all blocks.
+ * Disables contextual links for all blocks except for layout builder blocks.
*/
function seven_preprocess_block(&$variables) {
- if (isset($variables['title_suffix']['contextual_links'])) {
+ if (isset($variables['title_suffix']['contextual_links'])
+ && !isset($variables['elements']['#contextual_links']['layout_builder_block'])) {
unset($variables['title_suffix']['contextual_links']);
unset($variables['elements']['#contextual_links']);
@jeffam
Copy link
Author

jeffam commented Dec 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment