I'm attempting to create a custom field template for an image field with mutliple values. My field name is field_photo_slidshow
My field template name is: field--field-photo-slideshow.php and I've got it coded like this to produce a Flexslider slideshow:
<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if (!$label_hidden): ?>
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
<?php endif; ?>
<div class="flexslider"<?php print $content_attributes; ?>>
<ul class="slides">
<?php foreach ($items as $delta => $item): ?>
<li class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?>
<!-- <p class="flex-caption">Caption</p> -->
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
And this does what I want so far -- creates and unordered list of the rendered images. But now, I want to add an optional caption, derived from the Image fields alt tag -- but I have no idea how to render the ALT tag from a given image in the above code in the field tempalte. That part of the code, in theory, would something like this:
<?php foreach ($items as $delta => $item): ?>
<li class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?>
<p class="caption">ALT TEXT FROM IMAGE FIELD</p>
</li>
<?php endforeach; ?>
Doe anyone have any idea out to print out that alt text in the field template code?
thank you, Nathaniel