You are here

function contemplate_eval_enclosure in Content Templates (Contemplate) 7

Same name and namespace in other branches
  1. 5 contemplate.module \contemplate_eval_enclosure()
  2. 6 contemplate.module \contemplate_eval_enclosure()

Eval the RSS enclosure field

1 call to contemplate_eval_enclosure()
contemplate_node_view in ./contemplate.module
Implements hook_node_view().

File

./contemplate.module, line 884
Create templates to customize teaser and body content.

Code

function contemplate_eval_enclosure($field, $node) {
  $tmplt = '<?php print ' . $field . ' ?>';
  $xml_elements = array();
  $fid = contemplate_eval($tmplt, $node, $xml_elements);
  if (is_numeric($fid)) {
    $file = db_fetch_object(db_query('SELECT * FROM {files} WHERE fid = :fid', array(
      ':fid' => $fid,
    )));
    return $file;
  }
  return FALSE;
}