What's the purpose of [site:current-user] when there is already a top-level [current-user] token (which is provided by core)? Duplicating this is adding a 500 or so extra lines to the token tree help on my site with a few added fields on users.

Comments

dave reid’s picture

Category: support » bug

We also duplicate the [current-date:*] (if Token module is enabled) or [date:*] tokens which default to the current date under [site:current-date:*].

I would consider token duplication a bug. Working on a patch.

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new1.14 KB

Patch that re-adds using 'token' => FALSE in hook_entity_property_info() to disable tokens for that property since I thought that functionality had existed at some point and currently there's no way to disable tokens for specific properties.

dave reid’s picture

Grrr, wrong patch.

dave reid’s picture

Title: Completely unnecessary [site:current-user] tokens? » Completely unnecessary [site:current-user] and [site:current-date] tokens?

Status: Needs review » Needs work

The last submitted patch, 1575458-no-current-user-date-in-site-tokens.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new2.01 KB

Adjusted tests.

quicksketch’s picture

Thanks Dave Reid! I have to ask, why 'token' => FALSE? Using the term "token" seems awfully vague, but perhaps it makes sense. I'd think something like 'nestable' => FALSE would make sense, but it sounds like 'token' would have broader implications.

dave reid’s picture

Because all it does is simply disable that property from being available as a token? So really it only applies to being used in entity_token.

quicksketch’s picture

Oh, I didn't see where this addition was placed. Makes sense to me.

fago’s picture

hm, what is with the people already using this tokens? They would just stop working for them? :/

Maybe, we can find a way to let the tokens work but remove them from the token ui? Would just not adding them to token-info work/make sense?

dave reid’s picture

Honestly, it would mean they stop working. I can't see a way to disable them in the UI but allow the token replacement to work. Which is why it's unfortunate that they were added in the first place.

damien tournoud’s picture

Maybe it is time to start a 2.x branch of Entity?

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Dave's 7 year old patch in #6 applied cleanly to the latest entity 7.x-1.x-dev, but I believe this issue is outdated.