Currently there is no way to override the default_token_formatter through the Field UI. It should be as easy as defining a token view mode and using hook_field_display_alter() to override the display settings if $view_mode == 'token' and the view mode doesn't technically exist or it doesn't have custom settings.

#1 1252714-token-view-mode.patch4.05 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 245 pass(es).
[ View ]


Status:Active» Needs review
new4.05 KB
PASSED: [[SimpleTest]]: [MySQL] 245 pass(es).
[ View ]

Haven't tested the patch yet, but +1 for the concept.

Wait, why doesn't the view mode technically exist or have custom settings? How is it a view mode, then?

We would leave it disabled by default so that the user can modify it if the defaults are not as desired. Otherwise there's no need to both have the view mode enabled and with settings - we use 'default_token_formatter' in hook_field_info() in the 'default' case.



Oh, so you mean it's a normal view mode, just it doesn't default to the "has own settings page" option? That makes more sense then.

Yep that's it.

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Needs work

It's not working for user entities, does it?

For details, see #1727928: User token display - how to operate?

Status:Needs work» Closed (fixed)

Let's handle this in the other issue.