Skip to content

Instantly share code, notes, and snippets.

@mkorostoff
Created July 5, 2012 18:06
Show Gist options
  • Save mkorostoff/3055302 to your computer and use it in GitHub Desktop.
Save mkorostoff/3055302 to your computer and use it in GitHub Desktop.
<?php
/**
* This template is used to print a single field in a view. It is not
* actually used in default Views, as this is registered as a theme
* function which has better performance. For single overrides, the
* template is perfectly okay.
*
* Variables available:
* - $view: The view object
* - $field: The field handler object that can process the input
* - $row: The raw SQL result that can be used
* - $output: The processed output that will normally be used.
*
* When fetching output from the $row, this construct should be used:
* $data = $row->{$field->field_alias}
*
* The above will guarantee that you'll always get the correct data,
* regardless of any changes in the aliasing that might happen if
* the view is modified.
*/
?>
<?php
if (!empty($output)) {
$preset = '150w_250h_3x5_aspect_ratio';
print l(theme('image_style',
array('style_name' => $preset,
'path' => $output)),
'node/' . $row->nid,
array('html' => TRUE));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment