Perform layout_builder_entity_presave for content entities only.

Created on 16 May 2019, over 5 years ago
Updated 11 March 2024, 10 months ago

I encountered the same problem as described here: https://www.drupal.org/project/context/issues/3043383
When I saw in stacktrace layout_builder_entity_presave, I understand, what is the reason of this bug: Context is config entity, so Layout Builder could not be applied to it and there is no need to perform something on config entities presave.
So we need to change this condition

if (\Drupal::moduleHandler()->moduleExists('block_content')) {
...
}

to this

if ($entity instanceof ContentEntityInterface && \Drupal::moduleHandler()->moduleExists('block_content')) {
...
}
🐛 Bug report
Status

Closed: duplicate

Version

8.7 ⚰️

Component
Layout builder 

Last updated 4 days ago

Created by

🇧🇾Belarus gun_dose

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024