1

How can I show the field label when using tokens in Global field in Views.

To reproduce:

In a view:

1) Add field: title-field and enable to "Create a label" with value "My title".

2) Add field: Global Custom Text. In this field I use the token [title_field] for the text.

In the result the label is not shown. The token just print out the value but not the label. Even when I checked "Create a label" with value "My title" for the title-field

Can I get this? I know that this can be done with the views_php module but, I don't want to enable this module just to workaround this.

  • Why can't you hard code.. ? Any way it doesn't change contextually right ? Am i missing something here ! ? – Anil Sagar Apr 4 '14 at 9:00
  • with views_php I can use t() to create translatable labels. But I've read that this module adversely affects the performance of the site. – chefnelone Apr 4 '14 at 9:17
  • So you would like to display translated text of a label .. Makes sense.. Can you update your question ? – Anil Sagar Apr 4 '14 at 9:19
  • have you found a solution? because I also stuck on this problem enter link description here – user60539 Apr 22 '16 at 12:53
1

A workaround would be to just create your own label by typing it in.

ex 1: Title: [title_field]

ex 2: <b>Title:</b> <br>[title_field]

  • This wouldn't work to translate labels if you have multilingual site. – usmanjutt84 Feb 9 at 12:27
  • @usmanjutt84 indeed, if you're concerned about that, you would use a template file and put the label inside the t() function. – No Sssweat Feb 9 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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