Problem/Motivation

The condition reads the "node" route parameter and gives up if it is not a node. Paragraphs are not a node-only feature: taxonomy terms, media entities, users and custom entity types can all have paragraph fields, and their canonical pages are exactly the kind of page a site builder wants to target with a block.

A term page built out of paragraphs cannot be targeted at all today. The condition simply returns false there, with no indication of why, which reads like the module being broken rather than the module not covering that case.

The node-only approach also forces a dependency on the node module that the condition does not really need.

Steps to reproduce

1. Add a paragraph field to a taxonomy vocabulary.
2. Create a term holding a paragraph of a given type.
3. Configure a block with this condition and select that paragraph type.
4. Visit the term page. The block is hidden, because the condition only looks at the node route parameter.

Proposed resolution

Read the entity from the route generically instead of asking for the node parameter by name. The evaluation now walks the current route parameters and takes the first one that is a fieldable content entity, whatever its entity type. That covers nodes, taxonomy terms, media and anything else a site defines, with no per entity type code and nothing for the site builder to map.

Drop the node module from the dependencies, since it is no longer used.

Update the wording of the condition summary, the form description and the README, which all talked about nodes specifically.

Comments

trebormc created an issue. See original summary.

  • trebormc committed f39e49cf on 1.0.x
    Issue #3618996 by trebormc: Support any entity type, not only nodes.
    
trebormc’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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