You are here

function theme_calendar_calendar_node in Calendar 5

Themeable node display

Constructs a teaser out of any non-date fields in the view

1 theme call to theme_calendar_calendar_node()
calendar_calendar_node in ./calendar.module

File

./calendar.theme, line 133

Code

function theme_calendar_calendar_node($node, $type) {
  static $set_nodes;

  // For local nodes, make sure the same node does not get its
  // content altered more than once if it has multiple instances
  // in the calendar. Multiple day events might have the same nid,
  // so we need to use the combination of the nid and the instance
  // to get a unique key.
  if (in_array($node->nid . ':' . $node->instance, (array) $set_nodes)) {
    return theme($type, $node);
  }

  // Display the regular teaser view for local events.
  if ($type == 'calendar_node_day') {
    $node = node_load($node->nid);
    $node->teaser = node_view($node, TRUE, FALSE);
    $node->title = '';
  }
  else {
    if (isset($node->fields) && !isset($node->teaser)) {
      foreach ($node->fields as $field) {
        $node->teaser .= '<div>' . $field . '</div>';
      }
    }
    if (!$node->url) {
      $node->url = "node/{$node->nid}";
    }
  }
  $set_nodes[] = $node->nid . ':' . $node->instance;
  return theme($type, $node);
}