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
Members fund testing for the Drupal project. Drupal Association Learn more


Dave Reid’s picture

Status: Active » Needs review
4.05 KB
PASSED: [[SimpleTest]]: [MySQL] 245 pass(es). View
DamienMcKenna’s picture

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

Crell’s picture

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

Dave Reid’s picture

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.

zilverdistel’s picture


BenK’s picture


Crell’s picture

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.

Dave Reid’s picture

Yep that's it.

Dave Reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Shnapoo’s picture

Status: Closed (fixed) » Needs work

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

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

Dave Reid’s picture

Status: Needs work » Closed (fixed)

Let's handle this in the other issue.