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.
I am using the [node:group_audience] token in custom breadcrumbs and the [node:group_audience] is rendering with HTML hyperlink markup:
Home » <a href="/drupal-7.8/?q=administration">Administration</a> » Administration Wiki
Comments
Comment #1
bulldozer2003Anyone know where I can fix this token replacement to not add the markup as part of the replacement?
I'm moving this because I've gotten no traction in OG (where I guess the token is defined).
Comment #2
Dave ReidI just created a doc page on customizing how field tokens are output:
http://drupal.org/node/1299662
You may also want to point the og maintainers to http://drupal.org/node/1252608 on how to provide a sane default formatter for their field types.
Comment #3
bulldozer2003Thank you for the information! It looks like OG only offers one formatter :( I will look up how to define a new plain text formatter and submit it to OG as a patch.
The current formatter providing links should probably left as default. How would I define which formatter Tokens is supposed to use?
Comment #4
Dave ReidThis is covered by http://drupal.org/node/1252608 :) Transferring this issue back to OG.
Comment #5
bulldozer2003I've added the default_token_formatter to the og_field_info function (see below) in my site's og.field.inc file but "Group default list" is still the only formatter available to the Group Audience field. I also tried deleting the field and re-adding it.
Comment #6
amitaibuI think there are better ways to form a breadcrumb instead of using the field itself -- just using it's token, but anyway this formatter can be done in a custom module, it's out of the scope for OG itself.
Comment #7
bulldozer2003Do you have any suggestions of better ways to form a breadcrumb?
And doesn't OG provide the token definitions that Token can use?
Comment #8
bulldozer2003No traction with OG :-( I'm back to ask about the change I made to og_field_info if you see comment #5. Does the 'default_token_formatter' need to be defined anywhere else?
Comment #9
bulldozer2003Oh, I think I see the problem, I'm using 'taxonomy_term_reference_plain' in OG... I guess I do need to define a new plain formatter in OG?
Comment #10
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedSeconding the problem here. What are some alternative approaches to generating the breadcrumb, or to generating the token? Amitaibu, is it normal for a token to include HTML? If we throw together a plaintext formatter for group, can we get it included in the module as the default display formatter for this field in token form?
bulldozer2003: the latest dev of custom_breadcrumbs supports using raw PHP to generate an array that will be used as your breadcrumb. So we could use a PHP snippet to get around this token issue.
An alternate approach would be to improve custom_breadcrumb with an option to remove HTML from breadcrumb title elements. Hard to think of a use case where you would want it displayed, really...
Comment #10.0
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedPut text in code as HTML was being rendered.