1

I have a client who wants to be able to input a content type which allows for the upload of 4 different pdf files. They want to have a view that allows them to click on one link and load each pdf file in a separate tab. I can get this to work in the footer of the view with the global text option and inputting the following code:

<a href="[field_client_first_pdf]" target="_blank"  onclick="window.open('[field_client_second_pdf]','');window.open('[field_client_third_pdf]','');">[title]</a>

The problem is, I need this to work in the fields using the global text option but full html is not allowed there. I am trying to use a views template file to input the code but I can not figure out how to access the data that is supplied by the replacement patterns in the view. Any tips on how I can assign variables with the right data in the template file?

0

Use the Theme: Information in the Advanced part of the view configuration (you need to click the Advanced link to expand it).

Here you can explore all the possible templates for that specific view and specific display. But additionally you can click the specific template and see the default code (in your case you will use Row template I guess). There you can see the available variables.

To print out the specific values, I would recommend Devel module and then the kpr() or dpm() functions, like this: dpm($fields); in your template.

Alternatively, you can use debug($fields); without using the Devel module.

Important: Do not forget to delete these debug functions before deployment.

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.