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

  1. On a site with Canvas, enable Display Builder on a content type's display, with overrides, and publish an override.
  2. In Canvas, enable a content template for the same bundle and view mode.
  3. 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

Command icon 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

mogtofu33 created an issue. See original summary.

keerthi kumar made their first commit to this issue’s fork.

keerthi kumar’s picture

Issue summary: View changes
Status: Active » Needs review

opened 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.

mogtofu33’s picture

Status: Needs review » Needs work

Thanks, 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 renders full with the default display when full is not customized. So editing the default display while node.page.full is an enabled template shows no warning, which is the most common case. Could the check also cover the view modes that fall back to default, at least full?

Smaller points: @internal on the trait, a ConfigEntityInterface check instead of method_exists(), and the message in one method rather than three copies.