Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1252714-token-view-mode.patch | 4.05 KB | Dave Reid |
Comments
Comment #1
Dave ReidComment #2
DamienMcKennaHaven't tested the patch yet, but +1 for the concept.
Comment #3
Crell CreditAttribution: Crell commentedWait, why doesn't the view mode technically exist or have custom settings? How is it a view mode, then?
Comment #4
Dave ReidWe 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.
Comment #5
zilverdistel CreditAttribution: zilverdistel commentedsubscribe
Comment #6
BenK CreditAttribution: BenK commentedSubscribing
Comment #7
Crell CreditAttribution: Crell commentedOh, 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.
Comment #8
Dave ReidYep that's it.
Comment #9
Dave Reid#1 committed to 7.x-1.x-dev.
http://drupalcode.org/project/token.git/commit/980ff0d
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedIt's not working for user entities, does it?
For details, see #1727928: User token display - how to operate?
Comment #12
Dave ReidLet's handle this in the other issue.