0

I would like to render an image, with responsive styles at the top of a view.

The approach I have been using is to try to access to the full array that you get when calling render($content['field_banner']) from the view template.

I am using:

  • The views-view-bvt-tables--class-timetable--page.tpl.php template
  • The Picture module to map images styes to screen sizes
  • The Profile2 module

I have found the image using this code.

$profile_row = $result[0];
render($profile_row->field_field_studio_banner);

It gives a different result, compared to the following code, used in profile2.tpl.php.

print render($content['field_studio_banner']);

I can't see display properties, such as #formatter = picture in the view array.

How do I set any display property?

  • Most images allow styles to be set by using the Views interface. Are you sure you cannot set it there? – Neograph734 May 28 '16 at 9:06
  • Ah you are right. I was too busy playing with the template and forgot about the views config. – Interlated Jun 2 '16 at 19:46

Your Answer

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

Browse other questions tagged or ask your own question.