I'm sure I'm missing something very straightforward here: I want to prevent the thumbnail slider in my image gallery from being rendered if there's only one image for the node. My first thought was, optimistically:
<?php if (count($content['field_media']) > 1): ?> <div id="carousel" class="flexslider clearfix"> <div class="slides"> <?php print render($content['carousel']); ?> </div> </div> <?php endif; ?>
I saw why that didn't work when I examined the node structure. In an example case for a node with one image, I have
field_media (Array, 1 element) und (Array, 1 element) 0 (Array, 17 elements)
the last one being the actual file element with an fid, etc. The corresponding field for a node with two images is
field_media (Array, 1 element) und (Array, 2 elements) 0 (Array, 17 elements) 1 (Array, 17 elements)
So the array I need to count is nested inside the 'und' array. I know I've used that in other templates, like $field_external_link['und']['url']. But when I print count($content['field_media']['und']), I get 0. How do I evaluate the number of elements in that array?