template

Views template override function for a field to pad top of an image to center it

This method is dependent on running the images through an image style to ensure that the width and height tags are added to the img tag, and that the height of the area to be centered is known. This is pretty easy for fixed sized areas fitting images, like in a list or gallery.

Instead of making a views-view-field--featured--field-image-cache-fid.tpl.php file, this function produced the output instead. In this example, I know that the height of the div is of a fixed 155px in height.

Views theme template functions instead of template files

Normally when overriding a views template it's a case of create a file like views-view-unformatted--featured.tpl.php. But this is actually a performance hit when it could be picked up as a theme template function instead.

The above function would be

Subscribe to RSS - template