1

I created my custom content type and add field called 'Image' of type Image and set the content manager can set multiple images into it. Now this field is rendered as such html

<div class="field field-name-field-image field-type-image field-label-above">
  <div class="field-label">Image:&nbsp;</div>
  <div class="field-items">
    <div class="field-item even">
      <img typeof="foaf:Image" src="http://mydomain.com/sites/default/files/img1.jpg" width="400" height="314" />
    </div>
    <div class="field-item odd">
      <img typeof="foaf:Image" src="http://mydomain.com/sites/default/files/img2.jpg" width="400" height="260" />
    </div>
  </div>
</div>

I cannot find where are the template(s) which render this piece of html. I'd like to override it to render list of links, similar to

<div class="field field-name-field-image field-type-image field-label-above">
  <div class="field-label">Image:&nbsp;</div>
  <ul class="field-items">
    <li><a href="http://mydomain.com/sites/default/files/img1.jpg">img1.jpg</a></li>
    <li><a href="http://mydomain.com/sites/default/files/img1.jpg">img2.jpg</a></li>
  </ul>
</div>
1

1 Answer 1

3

The function is theme_field() which could be customized by having the right override of the field.tpl.php template in your theme (through template suggestion, see the theme_field() function documentation.

Inside this function/template, the image is rendered by a field formatter. The print render($item) statement print that rendering. The exact used function/template depends on the configured formatter. If your are usign the default formatter, that would be theme_image_formatter().

Note: See the theme() function's documentation for how to override the theme_* functions in your theme or module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.