Problem/Motivation

If a default layout has a custom block placed and overridden layouts exist, deleting the custom block from the default can trigger
Error: Call to a member function getEntityTypeId() on null in Drupal\layout_builder\Plugin\Block\InlineBlock->build() (line 218 of core/modules/layout_builder/src/Plugin/Block/InlineBlock.php).

Steps to reproduce

  1. Add a custom block to a layout default
  2. Begin editing a layout override, do not save
  3. Remove the block from the default
  4. Attempt to continue editing the layout override

Proposed resolution

If a block can not be loaded, change \Drupal\layout_builder\Plugin\Block\InlineBlock such that:

  1. a visual warning is shown to privileged users that the block is broken or missing, and
  2. log error.

Remaining tasks

User interface changes

N/A

API changes

\Drupal\layout_builder\Plugin\Block\InlineBlock::__construct now requires $logger to be passed.

Data model changes

N/A

Release notes snippet

If a default layout has a custom block placed and overridden layouts exist, deleting the custom block from the default can trigger an error in
InlineBlock->build() . A user-friendly warning message is now displayed and logged.

CommentFileSizeAuthor
#153 3049332-inline-block-153.patch3.81 KBjunaidpv
#152 3049332-inline-block-152.patch3.54 KBmauriciopieper
#144 3049332-inline-block.patch3.99 KBbapi_22
#134 drupal-core--2025-07-09--3049332--mr-12460.patch9.3 KBrajab natshah
#130 3049332-129-12460.patch8 KBwebflo
#128 drupal-core--2025-06-24--3049332--mr-12460.patch7.94 KBrajab natshah
#124 inlineBlock-3049332-10.3.14.patch8.27 KBrajveergangwar
#123 inlineBlock-3049332-10.3.14.patch8.45 KBrajveergangwar
#122 inlineBlock-3049332-10.3.14.patch5.03 KBrajveergangwar
#118 3049332_d10.3.0.patch7.81 KBmkalkbrenner
#94 3049332-nr-bot.txt1.79 KBneeds-review-queue-bot
#87 drupal-core--2024-01-09--3049332-87.patch7.72 KBanpolimus
#85 drupal-core--2024-01-09--3049332-85.patch7.74 KBrajab natshah
#83 call-null-inline-block-3049332-83.patch1.1 KBfarnoosh
#82 3049332-82-60-interdiff.diff525 bytesalecsmrekar
#82 3049332-82.diff7.83 KBalecsmrekar
#79 3049332-79.patch7.54 KBneclimdul
#79 3049332-79.interdiff.txt1.01 KBneclimdul
#72 3049332-60-test-only.patch3.5 KBpfrenssen
#69 3049332-69.patch10.82 KBalphawebgroup
#67 Error_layout_builder_unable-to-load-inlineblock.png76.2 KBnpcoder
#67 Error_layout_builer-recursive-rendering.png84.42 KBnpcoder
#66 After_patch.mp4353.06 KBprasanth_kp
#66 Before_patch.mp450.9 KBprasanth_kp
#63 3049332-63-log-error-instead-of-wsod--with-synchronized-translation.patch10.82 KBjessehs
#60 interdiff_59-60.txt2.45 KBdanflanagan8
#60 3049332-60.patch7.54 KBdanflanagan8
#59 3049332-59.patch7.62 KBdanflanagan8
#56 interdiff_54-56.txt477 bytesvsujeetkumar
#56 3049332-inline-56.patch7.67 KBvsujeetkumar
#54 3049332-inline-54.patch7.67 KBnwom
#53 3049332-inline-53.patch7.67 KBnwom
#52 interdiff_50-51.txt477 bytesvsujeetkumar
#51 3049332-inline-51.patch7.63 KBvsujeetkumar
#50 interdiff_49_50.txt1.03 KBanmolgoyal74
#50 3049332-inline-50.patch7.64 KBanmolgoyal74
#49 3049332-inline-49.patch7.5 KBwmcmillian
#48 3049332-inline-48.patch7.54 KBwmcmillian
#45 interdiff_35_45.txt7.8 KBanmolgoyal74
#45 3049332-inline-45.patch7.54 KBanmolgoyal74
#38 3049332-inline-35-interdiff.txt5.53 KBtim.plunkett
#38 3049332-inline-35.patch7.39 KBtim.plunkett
#33 3049332-inline-33-PASS.patch3.81 KBtim.plunkett
#33 3049332-inline-33-FAIL.patch3.02 KBtim.plunkett
#26 drupal-3049332-26-missing-inline-block.patch1.25 KBgeek-merlin
#25 drupal-3049332-25-missing-inline-block.patch1.24 KBgeek-merlin
#23 drupal-3049332-23-missing-inline-block.patch1.24 KBgeek-merlin
#22 3049332_22.patch3.34 KBvsujeetkumar
#11 interdiff-3049332-9-11.txt709 bytesgoz
#11 drupal-layout_builder_inline_block_empty_block_error-3049332-8.7.x-11.patch3.83 KBgoz
#9 interdiff-3049332-8-9.txt3.25 KBgoz
#9 drupal-layout_builder_inline_block_empty_block_error-3049332-8.7.x-9.patch3.83 KBgoz
#8 drupal-layout_builder_inline_block_empty_block_error-3049332-8.7.x-8.patch1.15 KBbkosborne
#5 drupal-layout_builder_inline_block_empty_block_error-3049332-8.7.x_0.patch641 bytesmathew.oakes
#4 drupal-layout_builder_inline_block_empty_block_error-3049332-8.6.x.patch645 bytesandyg5000
#4 drupal-layout_builder_inline_block_empty_block_error-3049332.patch645 bytesandyg5000
#3 drupal-layout_builder_inline_block_empty_block_error-3049332-8.6.x.patch648 bytesandyg5000
#3 drupal-layout_builder_inline_block_empty_block_error-3049332.patch648 bytesandyg5000

Issue fork drupal-3049332

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andyg5000 created an issue. See original summary.

andyg5000’s picture

Version: 8.6.x-dev » 8.8.x-dev
Issue summary: View changes

Added link to class/error

andyg5000’s picture

I'm including patches for 8.6.x so people can apply them to the current release if needed as well as the 8.8.x branch. Probably not the fix that will be chosen, but shows the issue and how to solve it. Cheers!

andyg5000’s picture

mathew.oakes’s picture

FWIW here's an 8.7 patch for the same flaw. These didnt apply for me.

bkosborne’s picture

Yes, I got this too. For some reason, the inline block was deleted but the reference to it is still on the page. No idea how that happened.

bkosborne’s picture

Here's a minor change that adds logging (without dependency injection). This needs tests and properly injected logger, but I just needed this quickly.

goz’s picture

Keeps it in needs review to let tests work.

Patch replace logger static call by injection.

Does someone can describe steps to reproduce please ? This will help to write tests.

Status: Needs review » Needs work
goz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.83 KB
new709 bytes

Replace logger service by logger.channel.layout_builder

bkosborne’s picture

I reproduced this by manually deleting the inline block in the database. Somehow that happened on a production site, but I'm not sure how. Only thing I can think of at the moment is that maybe two people were modifying a layout at the same time and one person deleted the block while the other kept it in the layout?

sam152’s picture

Isn't this masking potential data loss issues by not failing hard and explicitly? The underlying problem is that somehow an inline block was deleted when it shouldn't have been. Figuring out the root cause of why should probably be the first step.

Having this fail silently with a log message seems a bit dangerous, given in all future tests, the system as a whole will continue to work.

wturrell’s picture

(core 8.7.7) – I configured a layout for a content type using layout builder on dev, exported the config to Git, imported it to a production site I'm currently building (along with core.extension.yml to enable the layout_builder modules), cleared the cache, and:

- the nodes were showing both the layout builder content and the default 'manage display'-style fields simultaneously
- on clicking the 'Manage Layout' button in Manage Display, I got the InlineBlock.php:build() method getEntityTypeId() error above - NB: it's now line 223

I was able to disable layout builder, so I did that.

Then, I tried reimporting the dev synchronised config a second time.
Now the node displays as intended, but the error when trying to access the layout builder itself still persists.

Anyone else had this / suggest a solution or anything obvious I'm missing?

wturrell’s picture

…now I've had time to test:

(a) the latest patch (#11) applies and fixes (bypasses) the problem ( @bkosborne / Goz - thanks for adding the logging )
(b) it was my own fault for forgetting during the process I'd actually created a custom block, which I hadn't exported (and of course blocks, along with taxonomies and menus, don't get synced).

re: #13, personally I find the patch preferable, given that it at least allows you to view the Layout Builder UI, and that says "Placeholder" where the block content would be, so you can see what's wrong (maybe there's a case for using CSS to make that more prominent).

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: +Blocks-Layouts

NW for tests

albertski’s picture

This is how I get the error:
- Created a page using Page Manager and Layout Builder (Required patch: #2960739)
- Add inline blocks to the page
- Exported config
- Pushed changes to production/staging
- Import config
- Navigate to the edit layout page and you will see the error (Because the block doesn't exist)

This patch fixed the issue for me.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

energee’s picture

Confirmed patch working on 8.9.1.

vsujeetkumar’s picture

Assigned: Unassigned » vsujeetkumar
Issue tags: +Needs reroll

Reroll patch needed as not apply on 9.1.x

vsujeetkumar’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new3.34 KB

Reroll patch created, Please review.

geek-merlin’s picture

@Sam152 #13:
> Having this fail silently with a log message seems a bit dangerous, given in all future tests, the system as a whole will continue to work.

I strongly agree with this. Rerolled the patch to output a visible error message rather than a silent log message.

Setting NR to trigger bot, but still needs tests.

geek-merlin’s picture

Status: Needs review » Needs work

NW for tests.

geek-merlin’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB

Nope, #23 was the wrong patch. Here we go.

geek-merlin’s picture

StatusFileSize
new1.25 KB

Tested it manually, the last patch was missing the t(). Sorry for the noise.

geek-merlin’s picture

Status: Needs review » Needs work

Tested manually and worksforme.
Note that, apart from the error message, the block is shown as "Placeholder for the 'Foo' block".

IMHO the best would be if we show the block in error-red with text "'Foo' block (broken)".

NW for deciding this & automated tests.

rajab natshah’s picture

Thank you for the patch
It's working with default content

bradallenfisher’s picture

I can create this very easily without a cross env config sync.

  • site builder creates global template for basic page - "You are editing the layout template for all Basic page content items."
  • sets up the layout to have any number of predefined blocks in it.
  • user creates a bunch of nodes from this template
  • site builder then deletes any number of the predefined blocks from the original template
  • any node that was created while those blocks were present can no longer be edited by clicking the "Layout" tab. Error occurs.

I basically broke it within like 4 hours of playing with the builder. :) whoops.

bradallenfisher’s picture

I applied the patch in #26 and it's working very nicely. Thank you for the patch. The error is obvious.

tim.plunkett’s picture

Let's hope #29 is enough to write some tests from.

+++ b/core/modules/layout_builder/src/Plugin/Block/InlineBlock.php
@@ -215,6 +215,10 @@ protected function blockAccess(AccountInterface $account) {
     $block = $this->getEntity();
+    if (!$block) {

As currently documented, InlineBlock::getEntity() is always supposed to return a block. But RevisionableStorageInterface::loadRevision() can return a NULL, and this code doesn't account for it.

So getEntity() needs to be adjusted to either:

  1. allow for returning NULL (in which case all callers must account for that)
  2. throw an exception when the block cannot be loaded
  3. ALWAYS return a block (not sure that it's possible)
tim.plunkett’s picture

Assigned: vsujeetkumar » tim.plunkett
Issue summary: View changes

Aha! I was able to reproduce with one key addition:

  1. site builder creates global template for basic page - "You are editing the layout template for all Basic page content items."
  2. sets up the layout to have any number of predefined blocks in it.
  3. user creates a bunch of nodes from this template
  4. user clicks "Layout" tab on a node, but does not save changes
  5. site builder then deletes any number of the predefined blocks from the original template
  6. any node that was created while those blocks were present can no longer be edited by clicking the "Layout" tab. Error occurs.

Step 4 is the key here. It's the tempstore that is storing the old block revision ID.
Now we can write tests for this.

tim.plunkett’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new3.02 KB
new3.81 KB

I still think the fix should shift to getEntity(), but in the meantime here's a test with the patch from #26.

I'm also not sure about the logger vs message part. Now that we have steps to reproduce, this isn't as mysterious as it was (and definitely not a data loss problem).
I think a middle ground would be to mimic Broken block by returning a render array with the broken message, and logging it.

The last submitted patch, 33: 3049332-inline-33-FAIL.patch, failed testing. View results

tim.plunkett’s picture

StatusFileSize
new7.39 KB
new5.53 KB

In Slack, there was a discussion of the 3 options in the issue summary.
@jibran pointed to #3007424: Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD which is essentially the same problem.

So, conforming to that approach (aka #1 from the IS) but switching from a message to logging.

hudri’s picture

The same issue exists even without override layouts, when using configuration synchronization.

Steps to reproduce:

  1. Create a new node type on dev/staging environment
  2. Enable layout builder for this bundle (no override layouts)
  3. Create a default layout with inline blocks
  4. drush config:export, transfer config to live environment, drush config:import
  5. visit /admin/structure/types/manage/NODE_TYPE/display/default/layout
  6. WSOD due missing inline blocks, even without override layouts

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

galactus86’s picture

Version: 9.2.x-dev » 8.9.x-dev
Status: Needs review » Reviewed & tested by the community

Applied 3049332-inline-33-PASS.patch to Drupal 8.9.3 site. Overridden layout indeed had unsaved changes and a broken block ID.

Patch worked to get me past error message and able to edit and save page!

I have found similar types of issues with Layout Builder so will report back any additional blockers.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

The fix and test look great.

+++ b/core/modules/layout_builder/src/Plugin/Block/InlineBlock.php
@@ -81,14 +89,17 @@ class InlineBlock extends BlockBase implements ContainerFactoryPluginInterface,
+   * @param \Psr\Log\LoggerInterface $logger
+   *   A logger instance.
...
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, AccountInterface $current_user) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, LoggerInterface $logger, AccountInterface $current_user) {

This needs to be the last argument and trigger a deprecation notice like the $current_user argument... and then in D10 both with be required.

EDIT: The reason $logger was not added last is because $current_user was optional in D8 - because it was added and triggered a deprecation notice. So we need to do the same for this.

VoodooSource’s picture

Confirmed Patch in #11 works on 8.9.6

tim.plunkett’s picture

Version: 8.9.x-dev » 9.2.x-dev

Restoring version

anmolgoyal74’s picture

Status: Needs work » Fixed
StatusFileSize
new7.54 KB
new7.8 KB

I hope this is required here.

anmolgoyal74’s picture

Status: Fixed » Needs review

Status: Needs review » Needs work

The last submitted patch, 45: 3049332-inline-45.patch, failed testing. View results

wmcmillian’s picture

StatusFileSize
new7.54 KB

Rolled out #45 for Drupal 8.9

wmcmillian’s picture

StatusFileSize
new7.5 KB

Whoops... flipped around parameters to address #42

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new7.64 KB
new1.03 KB
vsujeetkumar’s picture

StatusFileSize
new7.63 KB

Fixing tests for 8.9.x.

vsujeetkumar’s picture

StatusFileSize
new477 bytes

This is the interdiff, Forgot to upload.

nwom’s picture

StatusFileSize
new7.67 KB

Looks like this needs a re-roll for both 9.1.x and 9.2.x. First is a re-roll for 9.1.x. No need for an interdiff, since nothing was changed (I tried making one regardless though, and it failed for some reason).

nwom’s picture

StatusFileSize
new7.67 KB

And here is the re-roll for 9.2.x

Status: Needs review » Needs work

The last submitted patch, 54: 3049332-inline-54.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new7.67 KB
new477 bytes

Fixing tests for 9.2.x.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

sershevchyk’s picture

The patch #56 works fine on 9.2.8

danflanagan8’s picture

Version: 9.3.x-dev » 9.4.x-dev
StatusFileSize
new7.62 KB

Here's a re-rolled patch that should apply on 9.2.x, 9.3.x, and 9.4.x. I'm changing the target branch for this fix to 9.4.x.

This is really close to being done, but the feedback from #42 has not been fully addressed yet. I will follow with a patch that addresses that feedback after confirming that the re-roll passes.

danflanagan8’s picture

Assigned: tim.plunkett » Unassigned
StatusFileSize
new7.54 KB
new2.45 KB

Seeing as the re-roll applied and passed, I am adding a new patch that fully addresses the comments in #42. We have to move the optional parameter to the end of the list of arguments. Note that there is typically NOT any test coverage added fo these kinds of deprecations, so we don't need to add any test coverage.

My understanding is that we've missed the time for deprecating for removal in 10.0.0. I've updated the deprecation notice to reflect the timeline as I understand it.

I'll also unassign this because I suspect @tim.plunkett isn't actively working on it. :)

farnoosh’s picture

Patch #56 worked on 9.2.9. Thank you!

xaa’s picture

Patch #60 working on 9.3.6 as well. Thank you!!

jessehs’s picture

Just in case anyone is looking for it... Here is a combination of the patch in #60, plus additions to make it work with 9.3.7 that is also patched with the synchronized layout override translations patch here.

ron collins’s picture

Patch #60 fixed my issue. Drupal 9.3.9.

I haven't used Layout Builder much.

My issue was that I created and inserted a block on my local, exported config and pushed it to a remote but then couldn't edit the layout on the remote. Removing the block from my local, exporting the config again and pushing to the remote still resulted in a broken layout on the remote.

This patch allows me to edit the config on the remote.

luke.leber’s picture

#60 seems to be a very elegant solution here. It has most of the features that I'd hope for:

  1. Prevents a WSOD :)
  2. Provides a simple and user-friendly front-facing message.
  3. Provides a more in depth diagnostic in the logs.

This solution even handles uncommon scenarios / irresponsible use cases like people deleting database rows directly.

One improvement that I'd love to see is for there to be some sort of classing applied to the broken block message. This would give themes the ability to:

  1. Hide the broken block from anonymous users?
  2. Add some sort of visual indication for staff that indicates "Hey!! Something isn't right here!!"

Thoughts?

prasanth_kp’s picture

StatusFileSize
new50.9 KB
new353.06 KB

Applied patch #60 fixed my issue Drupal 9.3

npcoder’s picture

I have the following configuration:

Drupal: 9.3.12
PHP: 8.0.10
MySQL: 5.7.29

Webserver: Apache/2.4.38 (Debian)

I had the same issue

Error: Call to a member function getEntityTypeId() on null

and applied patch #60.

After that, I got another issue. I clicked on the 'Edit' button of the node and clicked on the 'Layout' tab. As soon as I clicked on the 'Layout' tab, I see the white blank page spinning for a long time.

I stop the loading page and checked the Drupal log message. The following two messages were generated:

  1. Unable to load inline-block content entity with revision ID 1.
  2. Recursive rendering detected when rendering entity user:2, using the uid field on the node:1 entity. Aborting rendering.

My Finding:
I had enabled the Revison option for the specific Content Type where layoutbuilder was implemented.
Once removed the Revison, it worked.

Though it was a temporary fix, we still need revision on the content type.

Appreciate your help.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alphawebgroup’s picture

StatusFileSize
new10.82 KB

re-roll of #63 for 9.5.x which is also patched with the synchronized layout override translations patch here.

flyke’s picture

Patch #60 works on Drupal 9.4.1. Thanks !

mattjones86’s picture

This patch doesn't seem to apply with the MR from #2942975: [PP-1] Expose Layout Builder data to REST and JSON:API.

Not managed to work out which lines are conflicting yet.

pfrenssen’s picture

#60 is still the current patch. I have reviewed it. The fix looks sound, and has sufficient test coverage.

It still applies cleanly to 9.4.x up to 10.1.x. In the meantime 10.0.x and 10.1.x are in development so I started test rounds. What is missing is executing the tests on their own. We should see the original error message appearing in the tests. I am uploading the test-only version of patch #60. I have made no changes.

Status: Needs review » Needs work

The last submitted patch, 72: 3049332-60-test-only.patch, failed testing. View results

pfrenssen’s picture

Status: Needs work » Reviewed & tested by the community

Test proves that an exception was being thrown (even though the test output doesn't include the exact exception), so the test is correctly detecting the failure.

1) Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTest::testDeletion
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Unable to load inline block content entity with revision ID %vid.'
+'%type: @message in %function (line %line of %file) @backtrace_string.'

The patch in #60 looks RTBC. Thanks everyone!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

The deprecation message needs to be updated for 9.5.x since we won't change a constructor in 9.4.x and the issue summary needs to be updated to describe why logging is the correct solution.

rkelbel48’s picture

The patch in #60 works for me on Drupal 9.4.7. Thank you!

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lic_morua’s picture

The patch in #60 works for me on Drupal 9.5.5

neclimdul’s picture

Issue tags: +Needs change record
StatusFileSize
new1.01 KB
new7.54 KB

Updated patch to move this forward. moved deprecation to 10 as the latest release this would go in. Updated deprecation to match standard format. Needs Change Record to link to in the deprecation.

I don't know how to address the logging concern in #75 to update the issue summary. Why wouldn't you log the an error? Without logging something it would be one of those unknoweable unfixable errors right?

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alecsmrekar’s picture

Here's a small adjustment to #60 to allows admins to see the broken blocks, instead of suppressing the error "This block is broken or missing..."

alecsmrekar’s picture

StatusFileSize
new7.83 KB
new525 bytes

Attaching patch and interdiff

farnoosh’s picture

StatusFileSize
new1.1 KB

Having this error on Layout builder of an entity in my case the taxonomy term page in Core 10.0.10, so this patch is against 10.0.10

andyg5000’s picture

I like the approach in #82. Show the error that blocks are missing to those that have access.

rajab natshah’s picture

StatusFileSize
new7.74 KB

Re-role for the patch from #82 to apply for Drupal 10.2.1

pradhumanjain2311’s picture

The issue is in
@trigger_error('The logger service must be passed to InlineBlock::__construct(). It was added in drupal:9.4.0 and will be required before drupal:11.0.0.', E_USER_DEPRECATED);

as it is not in correct format.
%thing% is deprecated in %deprecation-version% and is removed from %removal-version%. %extra-info%. See %cr-link%
https://www.drupal.org/about/core/policies/core-change-policies/drupal-deprecation-policy

anpolimus’s picture

StatusFileSize
new7.72 KB

Attempt tp fix PHPSTAN.

anpolimus’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work

The Needs Review Queue Bot tested this issue.

While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

carolpettirossi made their first commit to this issue’s fork.

carolpettirossi changed the visibility of the branch 3049332-call-to-a-member-function-getEntityTypeId()-on-null to hidden.

carolpettirossi’s picture

Status: Needs work » Needs review

I created an MR with code from patch #87 as recommended by the "needs-review-queue-bot"

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.79 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

carolpettirossi’s picture

Still getting the PHPCS error on trigger_error. However, I'm wondering if that trigger_error is needed. Is there an intention to make $logger required in a future Drupal version? If yes, do we need a Change Record to link to?

danielveza’s picture

Correct yeah we would need a CR to be made for this as the logger is now required by InlineBlock

In my opininon, the trigger_error message should be formatted like existing examples. This example also includes a CR that could be used as a starting point.

froboy made their first commit to this issue’s fork.

froboy’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record

I've updated the message and created... 🥁 my first ever change record (please be gentle).

Thanks to @DanielVeza for the helpful example. I tried to follow that model, although I couldn't find any good examples of the constructor being called. I instead opted to use #3436810: \Drupal\layout_builder\Plugin\Block\InlineBlock::__construct() now requires a $logger parameter as an example of a constructor change. I'm very much open to suggestions for better examples there.

froboy’s picture

Test failures seem to be unrelated:

    There was 1 failure:
    
    1)    Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest::testUnmanagedGitIgnoreWhenGitNotAvailable
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Hiding patches for clarity.

Left some comments on the MR.

Leaving issue summary tag if that could be cleaned up please. Proposed solution seems like a question and there are some TBD spots. If there aren't, for example, UI changes it's fine to just N/A there.

froboy’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

Thanks for the feedback @smustgrave. I've resolved the MR comments and taken a pass at updating the issue summary.

smustgrave’s picture

Status: Needs review » Needs work

Thanks MR appears to have phpcs errors

froboy’s picture

Status: Needs work » Needs review

I've satisfied phpcs, but it looks like Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest is still failing.

smustgrave’s picture

Status: Needs review » Needs work

Would recommend rebasing the branch.

froboy’s picture

Status: Needs work » Needs review

Sorry... took a couple tries but I successfully rebased and tests are now passing.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback has been addressed

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs title update

This needs a title update so it makes sense in the git log.

smustgrave’s picture

Title: PHP message: Error: Call to a member function getEntityTypeId() on null (Layout Builder) » Log error + visual warning for missing or broken block
Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs title update

Done.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I've asked a couple of questions on the MR.

Carlos Romero made their first commit to this issue’s fork.

mkalkbrenner’s picture

StatusFileSize
new7.81 KB

Nothing changed, just a re-roll against Drupal 10.3.0 to ease the update for installations that require the patch.

flyke’s picture

Added issue #2942975 as related because its impossible to use this patch and patch from that issue at the same time.

arakwar’s picture

Adding issue https://www.drupal.org/project/drupal/issues/3180702 as related, because we also can't use both patches at the same time.

phjou’s picture

Just got the same error, patch #118 fixes the issue for us.

rajveergangwar’s picture

StatusFileSize
new5.03 KB

for my case patch #118 isnt applied completaly, so i created another patch which is working fine for me.

rajveergangwar’s picture

StatusFileSize
new8.45 KB
rajveergangwar’s picture

StatusFileSize
new8.27 KB

In previous patch, the test file was missing, so adding correct one.

imyaro’s picture

@rajveergangwar could you please fix PHP 8.4 deprecation warning in the latest patch?

Deprecated: Drupal\layout_builder\Plugin\Block\InlineBlock::__construct(): Implicitly marking parameter $logger as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/core/modules/layout_builder/src/Plugin/Block/InlineBlock.php

munish.kumar’s picture

#124 patch is not applied on Drupal 11.2.0.

rajab natshah’s picture

Attached a static drupal-core--2025-06-24--3049332--mr-12460.patch file to this point of MR12460.
To be used with Composer Patches and Drupal 11.2.0

webflo made their first commit to this issue’s fork.

webflo’s picture

Status: Needs work » Needs review
StatusFileSize
new8 KB

I tried to fix the last MR from @rajab natshah.

smustgrave’s picture

Status: Needs review » Needs work

Left comments in the MR.

oily made their first commit to this issue’s fork.

rajab natshah’s picture

Title: Log error + visual warning for missing or broken block » Fix Log error + visual warning for missing or broken block
rajab natshah’s picture

Attached a static drupal-core--2025-07-09--3049332--mr-12460.patch file, to this point of MR12460.
To be used with Composer Patches to patch Drupal ~11.2.0

rajab natshah’s picture

Status: Needs work » Needs review
finex’s picture

Thanks for the static patch @Rajab Natshah

firnas’s picture

Status: Needs review » Reviewed & tested by the community

Patch #134 worked well for me. Thanks @Rajab Natshah

nod_ changed the visibility of the branch 11.x to hidden.

nod_ changed the visibility of the branch feature/3049332-9.5.x to hidden.

nod_’s picture

Status: Reviewed & tested by the community » Needs review

Can someone confirm which MR is the one RTBC (12460?) and that the comments from MR 7008 are addressed in the latest MR?

smustgrave’s picture

Status: Needs review » Needs work

@rajab natshah seems you opened the 2nd MR 12460 can you mention what you are doing different from the original MR 7008 to help compare for review? Whichever is the correct MR though needs to update deprecation to 11.3 please

Thanks

smustgrave’s picture

Hiding patches while I'm at it

Thanks!

rajab natshah’s picture

One for 11.x and one for 11.2.x
Only needed to get the MR as a local patch.

bapi_22’s picture

StatusFileSize
new3.99 KB

Returning a default ["#markup'] in a null block content will create issue in some other places in block_preprocess like
if($block_content && $block_content->bundle() == "text_image") {}
Uploading a new Patch

bapi_22’s picture

maddysp3’s picture

#144 did not apply the patch but #134 applied for 11.2.8

rajab natshah’s picture

Version: 11.x-dev » main

graber made their first commit to this issue’s fork.

graber’s picture

Rerolled, still NW for now.

chamilsanjeewa made their first commit to this issue’s fork.

r.van.doorn changed the visibility of the branch 3049332-call-to-a-member-function-getEntityTypeId()-on-null to active.

mauriciopieper’s picture

StatusFileSize
new3.54 KB

Rerolling patch for Drupal 11.3

junaidpv’s picture

StatusFileSize
new3.81 KB

Re-rolled for 11.4.0.

Not tested yet.

anybody’s picture

Just ran into this issue with Dashboards module clicking the "Personalize" link. So the issue still exists.

webdrips’s picture

@junaidpv, the patch applied cleanly and the tested scenario below passed.

I tested 3049332-inline-block-153.patch on Drupal 11.4 with the following steps: enabled Layout Builder with per-node overrides on a test content type, added an inline custom block to the default layout, created a node and customized its layout, then removed the inline block from the content type's default layout.

The node-specific layout override continued to load and render correctly with no fatal errors, warnings, or WSOD.

graber changed the visibility of the branch 3049332-11.x to hidden.

graber changed the visibility of the branch origin/3049332-call-to-a-member-function-getEntityTypeId-on-null-11.x to hidden.

graber changed the visibility of the branch 3049332-call-to-a-member-function-getEntityTypeId()-on-null to hidden.

graber’s picture

Status: Needs work » Needs review

I think all feedback addressed, moving to review.

smustgrave’s picture

Status: Needs review » Needs work

Small changes but appears to be super close!

bkosborne’s picture

I merged in the latest from `main` and also resolved the latest feedback. I had some questions when reviewing this that I left above.