Limiting does not work for newly created nodes

Created on 5 June 2025, 2 months ago

While creating a new node, I recognized that paragraphs, that are configured forbidden, are still available to insert into the node.
I debugged that and saw, that in \Drupal\layout_paragraphs_limit\EventSubscriber\LayoutParagraphsLimitAllowedTypesSubscriber::typeRestrictions line 64 the call to
$entity = $paragraph->getParentEntity();
always returns Null for newly created nodes and therefore the restriction mechanism is not working.

If the node has been already saved, everything works as expected.

I found 2 probably related issues, but if I install the 2 patches from https://www.drupal.org/project/layout_paragraphs/issues/3352822#comment-... 🐛 Paragraph parent entity property is empty when adding new paragraphs Needs review i end up with the error message reported at https://www.drupal.org/project/paragraphs/issues/3255456#comment-16044594 🐛 Cannot access parent entity in hook_entity_create Needs review

Versions installed:
Drupal Core: 10.4.6
Paragraphs: 1.19.0
Layout Paragraphs: 2.1.1
Layout Paragraphs Limit: 1.0.4

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇭Switzerland megadesk3000

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

Comments & Activities

Production build 0.71.5 2024