3

I am using Drupal 7.38 and Views (7.x-3.11) to show fields. I can't seem to get standard token replacement working for text fields, e.g. [node:created] is not replaced with the relevant value.

This seems to work fine if I set views to show content rather than fields. Am I missing something obvious?

closed as unclear what you're asking by Mołot, Krishna Mohan, Scott Joudry, kiamlaluno Nov 4 '15 at 6:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

3

If you want to display the date the node was posted or created when showing fields, you don't need to use a token. Simply add the field Content: Post date to the fields of the view.

If you want to include this date in a Global: Custom text field in your View, be sure to have the field Content: Post date above the Global: Custom text field. The replacement pattern for the post date will appear by clicking on Replacement Patterns inside the custom text field (usually named [created]). You can also select Exclude from display in the post date field if you don't want it to show.

EDIT: Re-read your question, and I guess you are using Token Filter to insert tokens like [node:created] in a Long text field in your node, right? If this is the case, I'm afraid Views will not do a token replacement when rendering the field. There may be a way to modify the Views formatter to do this, but that's beyond my skills. See this post for a similar situation - you are able to use token replacements in your Views Header or Footer custom text, but not in a Field.

  • Thanks for the response, yes that's right the tokens are within a Long text field. I've just now managed to find a solution to this using the Advanced Text Formatter module which gives an extra option within Views to format text fields and a simple checkbox for token replacement. – Alex Murray Oct 24 '15 at 18:22
  • Wonderful. Good to know. You should post an answer and mark it as correct yourself, for future people looking for this. They encourage this in this forum. – argiepiano Oct 24 '15 at 18:38
3

The solution I found for this was the Advanced Text Formatter module, which allows you to set a new text format for text fields within Views, including an option to replace Tokens.

  • 1
    I'm trying to do the same thing - use a token in a Global custom text field in a view. I've installed the Advanced Text Formatter module, but can't see how to use it to configure the field. Thinking I'm missing something obvious, but perhaps not. Can anyone point me in the right direction? – Graham Mar 14 '16 at 12:24
  • // I'm trying to do the same thing - use a token in a Global custom text field in a view. // The functionality works with text and longtext fields on content types. Looking to add this to a Global custom text field in Views might be unsupported. – dreftymac Sep 28 '18 at 2:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.