You are here

function nodereference_preprocess_node in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 modules/nodereference/nodereference.module \nodereference_preprocess_node()

Theme preprocess function.

Allows specific node templates for nodes displayed as values of a nodereference field with the 'full node' / 'teaser' formatters.

File

modules/nodereference/nodereference.module, line 1031
Defines a field type for referencing one node from another.

Code

function nodereference_preprocess_node(&$vars) {

  // The 'referencing_field' attribute of the node is added by the 'teaser'
  // and 'full node' formatters.
  if (!empty($vars['node']->referencing_field)) {
    $node = $vars['node'];
    $field = $node->referencing_field;
    $vars['template_files'][] = 'node-nodereference';
    $vars['template_files'][] = 'node-nodereference-' . $field['field_name'];
    $vars['template_files'][] = 'node-nodereference-' . $node->type;
    $vars['template_files'][] = 'node-nodereference-' . $field['field_name'] . '-' . $node->type;
  }
}