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.

4
  • Why can't you hard code.. ? Any way it doesn't change contextually right ? Am i missing something here ! ?
    – Anil Sagar
    Commented Apr 4, 2014 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
    Commented Apr 4, 2014 at 9:17
  • So you would like to display translated text of a label .. Makes sense.. Can you update your question ?
    – Anil Sagar
    Commented Apr 4, 2014 at 9:19
  • have you found a solution? because I also stuck on this problem enter link description here
    – user60539
    Commented Apr 22, 2016 at 12:53

1 Answer 1

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]

2
  • This wouldn't work to translate labels if you have multilingual site. Commented Feb 9, 2019 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
    Commented Feb 9, 2019 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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