Generated with the help of an LLM.
Problem/Motivation
When Canvas has an enabled content template for a bundle and view mode, Canvas renders the entity, and the Display Builder display, overrides included, is ignored.
Both modules work as designed, but a user can build and publish a display or an override that never shows, with no message.
Steps to reproduce
- On a site with Canvas, enable Display Builder on a content type's display, with overrides, and publish an override.
- In Canvas, enable a content template for the same bundle and view mode.
- View the content: the Canvas template renders. The builder still edits the override.
Proposed resolution
Show a warning in the builder, and on Manage display where it is not hidden, when an enabled Canvas content template covers the same entity type, bundle and view mode.
Document the pairing in the FAQ.
Remaining tasks
- Maintainer review
User interface changes
Warning message is displayed on Manage Display and in the Display Builder when an enabled Canvas content template is active for the view mode.
Introduced terminology
None
API changes
None
Data model changes
None
Release notes snippet
N/A
Issue fork display_builder-3640929
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
keerthi kumar commentedopened MR adding warnings on Manage Display and in the builder when an enabled Canvas content template is active for the view mode, documented in the FAQ, and added unit tests.
Comment #5
mogtofu33 commentedThanks, the warnings read well and the trait keeps the check in one place.
One gap: Canvas picks its template by the view mode being rendered,
ContentTemplate::loadForEntity(), and core rendersfullwith thedefaultdisplay whenfullis not customized. So editing thedefaultdisplay whilenode.page.fullis an enabled template shows no warning, which is the most common case. Could the check also cover the view modes that fall back todefault, at leastfull?Smaller points:
@internalon the trait, aConfigEntityInterfacecheck instead ofmethod_exists(), and the message in one method rather than three copies.