when one wants to use token for multiple objects, the global tokens are included for each object per default. So they are run multiple times.

-> the attached patch introduces a new optional parameter, which allows one to hide the global tokens. per default the behaviour stays as is.

note that token_replace_multiple() also keeps compatible with the old way - although it would make sense to not "add" global tokens there by default, as they can be added in the $types array. However I don't think people have done this until now, so the patch stays compatible by just adding the new parameter.

If the patch is welcome,
* I'd provide a 6.x version too
* I'd migrate workflow-ng's and rules' token integration to use it.

CommentFileSizeAuthor
token_global_5.patch6.02 KBfago

Comments

dave reid’s picture

Status: Needs review » Closed (won't fix)

At this point I think this is out of scope of the module. Marking as won't fix.