0

I have a content type teaser with an image field and display these teaser in a panel layout. This works perfect if I choose the Build Mode "Full Content" in the Panel Settings for the content.

I themed the content type with a node template (node--xyz.tpl.php) and have no checks about the view_mode in it. I print out the image with the function render():

<?php print render($content['field_teaser_image']); ?>

I'm very confused, as I wrote above, with the Build Mode "Full Content" it works fine. I've checked the Manage Displays Settings and they are the same for both View Modes. The Variable in the render() function is filled in both cases, but in View Mode "Teaser", the output is empty.

  • Did you check variable in template file? Maybe template was not accepted by Drupal. Did you add your template in theme path? Cleaned caches? – FriOne Jul 29 '14 at 7:59
  • Yes, the template is the correct one, $variables too, every thing else is rendered correctly, except the image field – moertle Jul 29 '14 at 8:02
  • @moertle to be clear, did you dump $variables in template file? In file node--xyz.tpl.php you have dpm() or var_dump()? If so could you please show this two arrays(from full and teaser), to understand why it not renders. – FriOne Jul 29 '14 at 8:29
  • Comment out the print render statement for the image and just print out a text message at that exact place in the template file. Then see if it prints out in the teaser view. Templates have conditional code for the view mode so maybe it is in a branch where only full view mode is accessible. – J. Reynolds Sep 12 '14 at 11:32
0

Check http://YOUR_SITE.NAME/admin/structure/types/manage/YOUR_CONTENT_TYPE/display/teaser

You have to add field_teaser_image to visible fields list.

Field UI module must be active.

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.