Problem/Motivation

Using Paragraph Blocks with enabled translations and path prefixes like 'en' lets method ParagraphBlocksEntityManager->getRefererEntity() always return null because the path prefix isn't respected and the subsequent method ParagraphBlocksEntityManager->getEntity() cant find the entity.
This in turn leads to less useful block labels presented by Paragraph Blocks in Layout Builder node override forms, because all lack the admin title provided by Paragraph Blocks

Steps to reproduce

  1. configure Content Translation and language path prefixes
  2. use Layout Builder and allow custom node layouts
  3. use a nodes layout form on a node with paragraph blocks and also admin titles added to it
  4. in place block form only shows paragraph block names like 'Paragraph type item 0'

Proposed resolution

I looked into the ParagraphsBlockEntity and propose a rewrite of this class.

Remaining tasks

Probably more refactoring of the whole entity manager structure might be useful.

Comments

akoe created an issue. See original summary.

akoe’s picture

A suggestion of a rewrite and fundamental refactoring would be still a open todo.

ansergeyg’s picture

I can confirm the issue.
Actually, this comment says it all:
https://git.drupalcode.org/project/paragraph_blocks/-/blob/8.x-2.x/src/ParagraphBlocksEntityManager.php#L96

The assumption is wrong because with multilingualism enabled,
the path starts with, say, en/node/id but not with /node/id

So this code:
list($entity_type_id, $entity_id) = $parts;
has $ntity_type_id equals to en, thus failing to retrieve the entity.

The patch seems to work.

Regards, Sergey

loziju’s picture

Status: Needs review » Reviewed & tested by the community

Patch tested working for me too!

vaibhavjain’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the work. Patch merged

  • vaibhavjain committed faf79de on 3.x authored by akoe
    Issue #3189181 by akoe: Language path prefix breaks method...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.