You are here

function paging_fetch_body_summary in Paging 7

Return the summary view of the body that will be split by breaks.

Parameters

$node: A fully loaded node object.

$safe: Weather requesting the safe value or not.

Return value

The summary text from the body, or main field of that node.

1 call to paging_fetch_body_summary()
paging_node_view in ./paging.module
Implements hook_node_view().

File

./paging.module, line 566
Allows a node to be broken into multiple pages via a tag.

Code

function paging_fetch_body_summary($node, $safe = FALSE) {
  $summary = '';
  $field = variable_get('paging_field_' . $node->type, 0);
  if ($field && isset($node->{$field}) && $node->{$field}) {
    $lang = isset($node->{$field}[$node->language]) ? $node->language : LANGUAGE_NONE;

    // Some body fields appear not to have a 'safe_summary'.
    if ($safe && !empty($node->{$field}[$lang][0]['safe_summary'])) {
      $body = $node->{$field}[$lang][0]['safe_summary'];
    }
    else {
      $summary = $node->{$field}[$lang][0]['summary'];
    }
  }
  return $summary;
}