- Issue created by @webdrips
- 🇬🇧United Kingdom scott_euser
Hi! This module just opts in to using the field, it does not actually provide the functionality. You would needs to raise an issue with Drupal Core (or move this one). Thanks!
After upgrading from Drupal 10.3 to 10.4, entity reference fields using the
“Views: Filter by an entity reference view” selection method no longer apply contextual filters
when the default value is set using a token (e.g., [node:field_reference]
).
While the view behaves correctly in the preview (the contextual filter resolves as expected), the
autocomplete field on the edit form ignores the contextual argument. This results in an
unfiltered list of all possible entities instead of a scoped list based on form context.
This impacts editorial workflows that depend on context-aware filtering (e.g., selecting a related item based
on another selected field).
Not sure if this should have been a bug or feature request?
field_parent_ref
) referencing Parent.field_related_item
) which should be scoped to the parent.field_related_item
(e.g., nodes, terms, or users).field_parent_ref
).[node:field_parent_ref]
.field_related_item
to use this view.Expected: Autocomplete results for field_related_item
are filtered by the parent.
Actual: Results are unfiltered; all entities are shown.
During entity editing, the context (e.g., the current node) is not passed to the view when resolving token-based
default arguments. This appears to be a regression introduced in or around Drupal 10.4.
A workaround using hook_views_pre_view()
can inject the needed contextual argument manually,
but this is not ideal.
A proper fix would:
[node:field_*]
in that context.Active
1.0
Code
Hi! This module just opts in to using the field, it does not actually provide the functionality. You would needs to raise an issue with Drupal Core (or move this one). Thanks!