Problem/Motivation

The “Remove markup on the referenced entity” setting currently only takes effect when “Remove field markup” is also enabled.
These options serve different purposes. We need to preserve the referencing field’s markup and label while removing the referenced entity’s outer wrappers.
For example, a news article has an author reference field with a visible label. The referenced contact renders through an SDC component. We want to retain the author field and label, but remove the contact entity’s additional and content wrappers.

How this became visible with SDC Display

The patch from SDC Display issue #3452441 preserves the entity render array instead of replacing it, retaining properties needed by other modules.
Previously, SDC Display discarded the entity’s theme information, so its outer wrappers were absent regardless of No Markup’s referenced-entity setting. This masked the dependency between No Markup’s two options.
After applying the SDC Display patch, the entity wrappers render again. Enabling only “Remove markup on the referenced entity” does not remove them because nomarkup_preprocess_field() returns early when field markup removal is disabled.
The SDC Display patch therefore exposed an existing limitation in No Markup rather than introducing that dependency.

Steps to reproduce

Create an entity reference field using the “Rendered entity” formatter.
Configure the field to display its label.
Leave “Remove field markup” unchecked.
Enable “Remove markup on the referenced entity”.
Render the parent entity.

Proposed resolution

Remove the early return based on the enabled setting from nomarkup_preprocess_field(). Apply the referenced-entity flag based on the field type and referenced_entity setting independently.
Field template selection already checks enabled separately, so field markup removal can continue to behave as configured.

Issue fork nomarkup-3631117

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

anskelt created an issue.