You are here

function theme_nodereference_formatter_full_teaser in Content Construction Kit (CCK) 6

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

Proxy theme function for 'full' and 'teaser' nodereference field formatters.

1 string reference to 'theme_nodereference_formatter_full_teaser'
nodereference_theme in modules/nodereference/nodereference.module
Implementation of hook_theme().

File

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

Code

function theme_nodereference_formatter_full_teaser($element) {
  static $recursion_queue = array();
  $output = '';
  if (!empty($element['#item']['nid']) && is_numeric($element['#item']['nid'])) {

    // If no 'referencing node' is set, we are starting a new 'reference thread'
    if (!isset($node->referencing_node)) {
      $recursion_queue = array();
    }
    $recursion_queue[] = $node->nid;
    if (in_array($element['#item']['nid'], $recursion_queue)) {

      // Prevent infinite recursion caused by reference cycles :
      // if the node has already been rendered earlier in this 'thread',
      // we fall back to 'default' (node title) formatter.
      return theme('nodereference_formatter_default', $element);
    }
    if ($referenced_node = node_load($element['#item']['nid'])) {
      $referenced_node->referencing_node = $node;
      $referenced_node->referencing_field = $field;
      _nodereference_titles($element['#item']['nid'], $referenced_node->title);
      $output = node_view($referenced_node, $element['#formatter'] == 'teaser');
    }
  }
  return $output;
}