You are here

function quotes_view in Quotes 5

Same name and namespace in other branches
  1. 6 quotes.module \quotes_view()
  2. 7 quotes.module \quotes_view()

Implementation of hook_view().

1 call to quotes_view()
quotes_block in ./quotes.module
Implementation of hook_block().

File

./quotes.module, line 481

Code

function quotes_view($node, $teaser = FALSE, $page = FALSE, $links = FALSE, $max_length = 0) {
  global $user;
  if ($page) {

    // Breadcrumb navigation.
    $breadcrumb = array();
    $breadcrumb[] = array(
      'path' => 'quotes',
      'title' => t('Quotes'),
    );
    $breadcrumb[] = array(
      'path' => "quotes/{$node->uid}",
      'title' => t("!name's quotes", array(
        '!name' => $node->uid ? $node->name : variable_get('anonymous', t('Anonymous')),
      )),
    );
    $breadcrumb[] = array(
      'path' => "node/{$node->nid}",
    );
    menu_set_location($breadcrumb);
  }

  // Prepare the node content.
  if (!isset($node->quotes_format)) {
    $node = node_prepare($node);
    $node->content['body'] = array(
      '#value' => theme('quotes_quote', $node, $teaser, FALSE, $max_length),
      '#weight' => 0,
    );
  }
  else {
    $quotes = array();
    foreach (_quotes_parse_import($node) as $quote) {
      $quote->body = check_markup($quote->body, $node->format, $user->uid == $node->uid);
      $quotes[] = theme('quotes_quote', $quote);
    }
    $node->content['body'] = array(
      '#value' => theme('item_list', $quotes, t('!count quotes will be imported:', array(
        '!count' => count($quotes),
      ))),
      '#weight' => 0,
    );
  }
  return $node;
}