- Issue created by @vibrasphere
- π±πΉLithuania vibrasphere
The DOMPurify library solves the problem for captions on Colorbox itself, but not for HTML Title tag within
<img>
, it still renders as&
which wouldn't be the problem if Title wasn't rendered at all because it is disabled in the image field setting, but somehow Colorbox overrides and forces it. - First commit to issue fork.
- π¨π΄Colombia ismaelromero Somewhere in the exotic Colombia
I was able to replicate the error you mentioned in a local environment, as shown in the screenshots below:
Alternative text configuration
Sourcecode without entity
Alt text without entityTo address this, I added \Drupal\Component\Utility\Html::decodeEntities to Xss::filter($caption) in the _colorbox_formatter_get_caption function located in web/modules/contrib/colorbox/colorbox.theme.inc. I also committed this solution to the 3469260-custom-caption-with-tokens branch.
After clearing the cache, the updated results can be seen in the following screenshots:
Source code with entityI am submitting the ticket for review and am available for any suggestions or feedback.
- Merge request !47fix - Custom caption with tokens doesn't render HTML characters β (Merged) created by ismaelromero
- πΊπΈUnited States paulmckibben Atlanta, GA
Thanks for documenting and fixing this issue. Merging the MR.
- Status changed to Fixed
10 days ago 5:10pm 27 March 2025