You are here

function og_node_view in Organic groups 5.3

Same name and namespace in other branches
  1. 5.8 og.module \og_node_view()
  2. 5 og.module \og_node_view()
  3. 5.2 og.module \og_node_view()
  4. 5.7 og.module \og_node_view()

Similar to node_view() but without calling theme('node').

This is needed to get the proper body or teaser for nodes (e.g. Event, Location, CCK node types) and to clean up the body for use in notifications.

Parameters

$node: The node object you want to view.

$teaser: Boolean to select the teaser or the body of the node.

Return value

The requested data, filtered and ready for use in an e-mail.

See also

node_view()

og_mail()

File

./og.module, line 1835

Code

function og_node_view($node, $teaser = FALSE) {

  // Remove the delimiter (if any) that separates the teaser from the body.
  // TODO: this strips legitimate uses of '<!--break-->' also.
  $node->body = str_replace('<!--break-->', '', $node->body);

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view')) {
    node_invoke($node, 'view', $teaser, TRUE);
  }
  else {
    $node = node_prepare($node, $teaser);
  }

  // Allow modules to change $node->body before viewing.
  node_invoke_nodeapi($node, 'view', $teaser, TRUE);
  return $teaser ? $node->teaser : $node->body;
}