Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The token replacement for the ID of an Entity reference field is 0 unless the Entity ID formatter is used for that field.
To reproduce:
- Create a new View
- Add the "Content: Authored by" field
- In the "Configure field" dialog
- Expand "Rewrite results" fieldset
- Tick the "Override the output of this field with custom text" checkbox
- Enter something similar to
{{ uid }} is {{ uid-target_id }}
in the text field
- Apply
The uid-target_id
is shown as 0.
If the field "Formatter" is set to "Entity ID" then it works as expected.
Comments
Comment #1
mikeker CreditAttribution: mikeker as a volunteer commentedComment #2
mikeker CreditAttribution: mikeker as a volunteer commentedSee: #2371633: Views uses hyphens in many tokens, but that is not valid Twig syntax..