A body might contain embedded entities that need to be transformed by the AMP library, including media entities, but currently the library is used before the filters have been applied. This means that if embedded entities contain images or other items that need to be transformed, they won't be.
We need to update this processing so it happens in this order:
- Transform any embedded entities in the body (and any other changes the filter system wants to make)
- Apply the AMP library transformations to the updated body markup.
In addition, when we use '#markup', we also need to pass '#allowed_tags' with a list of the AMP tags in the text. Without this step, Drupal's sanitization will still strip the AMP markup out of the result.
Patch coming.
Comments
Comment #2
karens commentedPatch.
Comment #3
karens commentedComment #5
karens commentedComment #6
karens commentedComment #8
karens commentedAdd tests for the transformation of images in the body, which indicated that #allowed_tags has to be expanded using the Xss allowed tags list.
Comment #9
karens commentedExpand on the title.
Comment #11
karens commentedWill probably add more tests later, but seems to be working.