I'm using a Drupal module that fetches views data via HTTP. Field names might contain the character :
. In that case loading the view fails with the message "Tokens need to be valid Twig variables". This happens even if the field is not used as token.
The origin of this error is here: https://git.drupalcode.org/project/drupal/-/blob/10.3.3/core/modules/vie... (or line 390 or 394)
If evaluating assert()
is not enabled, the view loads as expected.
Create a view with a field name that contains a character that doesn't match the regex in the assert()
linked above. When the view is loaded either as preview or explicitly the error occurs.
Allow field names that aren't allowed as PHP variable names by replacing not allowed characters with another string (e.g. ___
) when evaluating tokens. There is a possibility of naming conflicts, though not to be expected. However, code could be added that throws an exception in that case.
Active
10.3 β¨
Last updated