Error when enabled editing for paragraph which is placed inside the block in layout builder.

Created on 19 October 2023, 8 months ago
Updated 20 October 2023, 8 months ago

Problem/Motivation

The problem is that in frontend_editing_entity_view_alter() function we have a code:

$parent_entity = $entity->getParentEntity();

But method getParentEntity() could return NULL in some cases. For example, when we enable editing for the paragraph type. We have a block with field reference to this paragraph and add a block with layout builder. In this case, we create a content block and on this step, it didn't have an ID so this function returns NULL. Then it will be impossible to submit a form.

Proposed resolution

Add a validation for the $parent_entity variable.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine _shY Lutsk

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

Comments & Activities

Production build 0.69.0 2024