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.
Hi Folks,
The token_replace function runs after json_encode which is handling the escaping, so any replaced tokens are not escaped leading to issues with validation.
The attached patch is what I added to hook_amp_metadata_alter to fix the issue.
Scott
Comment | File | Size | Author |
---|---|---|---|
#2 | interdiff-2755257-1-2.txt | 1.1 KB | RainbowArray |
#2 | 2755257-2-token-replacement.patch | 1.11 KB | RainbowArray |
Comments
Comment #2
RainbowArrayFurther improvements to this. strip_tags was running after the json encoding, which is also too late. So running that in array_walk_recursive as well as removing newline characters. All of these primarily affect the description.
Comment #4
mtiftLooks good! Thanks @scottfalkingham and @mdrummund! Committed to 7.x-1.x.