I have a 'Link' field that is entered in plain text by user. I am trying to display the raw value of this field in my views template. I did dsm($fields); in the views template.

For the field, the raw data shows as a node id, not the url the user entered. The content attribute shows the url but it is wrapped in html. This is also the case when using ->content or ->raw in my views template.

I need to only print the plain url text the user entered in the template. How can I do this?

Here are the results for content and raw value:

enter image description here

  • Even before you solve your problem, please understand that outputting raw content that is put in by users is never a good idea. You are setting yourself up for CSRF and XSS security breaches. If you are doing this in a template file, you really need to make sure that the raw content is handled by Drupal's built-in filtering functions. Apr 29, 2015 at 19:46
  • Having said that, what is the view displaying content or fields? If you are displaying fields, then there should be a way to get the raw value in the field-level configuration of the view. Apr 29, 2015 at 19:48
  • The view is displaying fields. I got the raw data from using dsm($fields). The raw data doesn't show the Link url entered by the user, it shows the node id where the Link was entered. Is this suppose to be the case or is something broken? Is there another way to display the plain text entered by the user without any HTML, other than using raw value?
    – srodrig
    Apr 29, 2015 at 20:35
  • 1
    if you're using the Link module, you can choose how the link is displayed, including plain text
    – Geoff
    Apr 29, 2015 at 21:53

2 Answers 2


if you're using the Link module, you can choose how the link is displayed, including plain text

The link module can be count to the top 50 modules in Drupal installations and provides a standard custom content field for links. With this module links can be added easily to any content types and profiles and include advanced validating and different ways of storing internal or external links and URLs. It also supports additional link text title, site wide tokens for titles and title attributes, target attributes, css class attribution, static repeating values, input conversion, and many more.

  • Thanks, I've tried using the Link module but I was running into similar issues in the views template. Could you tell me how I would re-print the Link url and title in a template file? (not in the Views UI)
    – srodrig
    Apr 30, 2015 at 12:46

I figured out what needed to be used in the Views template:


This gets the text entered by the user. No need to change to Link field or get the raw value.

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.