- πΊπΈUnited States jvogt Seattle, WA
I ran into this too and digging around it looks like it's because the filter has to disable caching (see token_filter_filter_info() in token_filter.module). See text_field_load() in text.module for details on how the safe_value is set. It only sets the safe_value if the filter format allows caching.
You can get the safe_value manually by passing the value through check_markup():
// $entity_wrapper is an entity_metadata_wrapper $field_value = $entity_wrapper->field_my_field->value(); $safe_value = $field_value['safe_value'] ?? check_markup($field_value['value'], $field_value['format']);
There's also an open issue with a patch to add a setting to toggle the caching: https://www.drupal.org/project/token_filter/issues/2055307 β
- Status changed to Closed: outdated
about 1 month ago 11:39pm 16 January 2025 - π¦πΊAustralia darvanen Sydney, Australia
Thanks for the information @jvogt, I'm sure it will help others in this situation.
As this ticket is for 7.x and Drupal 7 is now out of support I am closing this ticket as outdated.