I am working in my Row style template (views-view-fields--MYVIEW--block-1.tpl.php). I need to get the file ID and path of an image. The image field is a multi field, so I need to get all of the images for each row. How do I do this?

I also will need to get the delta value of each image.

I try using kpr($variables) but I can't click to expand:

enter image description here


The THEME_preprocess_views_view_fields(&$var) function in the template.php in your theme directory is get called just before loading the Row Views Template file. Every component of the current row is saved inside the $var array.

To get what you need, simply just kpr($var) and it gives you all of the information about the current row. You can also save these information in the $var array as an index and use them later.

  • I tried kpr($variables) in my view template. It shows Array 30 elements but I can't expand it to see. Do I need to change a setting? Krumo display is set to default – srodrig Jul 23 '15 at 19:58
  • Only one click on any of them expand it. Was there any js error in console? – M a m a D Jul 23 '15 at 21:01
  • No js error. Updated question with screenshot of kpr output – srodrig Jul 23 '15 at 21:05
  • How many recordes the View displays? And how many fields each row has? Since this function is get called for every row so if the View contains many rows it maynot work properly. Limit the View to show just 1 record – M a m a D Jul 23 '15 at 21:12
  • I have multiple multi fields that I will need to loop through somehow. The multi fields are Image, Link (to a pdf file), and Caption. Each of these need to display for each row. – srodrig Jul 24 '15 at 13:37

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.