If you use __alt__ or __title__ field tokens outside of an element's attributes, like in a div or a span, the token will still get inserted if the field is left blank.

There's a step to cleanup unused tokens that checks for the tokens that doesn't apply in this use case. It will only replace the tokens if they're surrounded by quotes "".

CommentFileSizeAuthor
#2 insert-2984894-removed_generic_regexp.patch617 bytessnater

Comments

jascote created an issue. See original summary.

snater’s picture

Status: Active » Needs review
StatusFileSize
new617 bytes

That use-case seems to not have been foreseen. But I found out the quotes are there for a reason--#1126994: 2 double-spaces causes wrong path when using Transliteration--which is why I would not want to just remove the quotes again. An improvement might be to not rely on a single regex and loop through all possible field names. (The patch will need to be applied to the D8 version of Insert as well.)

jascote’s picture

Applying the patch file fails for 7.x-1.4.
However, the code in your patch works. I've tested that separately.

  • Snater committed 6e3d406 on 7.x-1.x
    Issue #2984894: Improved replacements cleanup
    

  • Snater committed 90ddd3c on 8.x-2.x
    Issue #2984894: Improved replacements cleanup
    
snater’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Needs review » Fixed

Thanks for filing the ticket and testing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.