Support configurable element names for elements built using layouts

Created on 18 September 2024, 2 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

Since 3.0.0-pre-alpha, CustomElementsGenerator::buildEntityContent() calls setTag(CE-CONFIGURED-NAME) when building content using CE config/fields, or when using processors, but not when using layouts. (I never asked why not.) *

But since 🐛 drupal prefix is added to configured custom element names Active , the (default) tag name changed from "node" to "node-TYPE-VIEWMODE". That makes its non-configurability inconvenient for people updating from version 2.

Proposed resolution

Use the configurable tag name in all three different 'build modes'. That's also more consistent.

Note:

  • This still doesn't make things perfectly backward compatible, because the "type" (+ "view-mode") attribute, which used to be added by getEntityDefaults() is not added anymore. I've added an example hook_custom_elements_alter() to the related CR to restore that, if needed.
  • I don't think we should just say "use the hook_custom_elements_alter() to override the tag/name too, if you cannot use the new tag/name", instead of making it configurable in the CE display. The hook has no good info to distinguish entities/custom elements built by Layout Builder, from other ones.
  • For the same reason (cannot distinguish 'build modes' in isApplicable()), I think implementing Move layout builder code into processor service Active wouldn't solve this nicely.

* (Because I didn't know the code yet. I figured there'd be a reason for it, like a non-dynamic name configured in a CE display would be detrimental for layouts. Or something. But by now, I'm guessing this wasn't the case and it might have been an oversight.)

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024