function quotes_view in Quotes 6
Same name and namespace in other branches
- 5 quotes.module \quotes_view()
- 7 quotes.module \quotes_view()
Implementation of hook_view().
File
- ./
quotes.module, line 503 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_view($node, $teaser = FALSE, $page = FALSE, $links = FALSE) {
global $user;
if ($page) {
// Breadcrumb navigation.
$breadcrumb = array();
$breadcrumb[] = l('Home', variable_get('site_frontpage', 'node'));
// Get the menu title.
$menu_info = menu_get_item('quotes');
$menu_title = $menu_info['title'];
$breadcrumb[] = l($menu_title, 'quotes');
$username = $node->uid ? $node->name : variable_get('anonymous', t('Anonymous'));
$breadcrumb[] = l(t("!name's !menu", array(
'!menu' => $menu_title,
'!name' => $username,
)), "quotes/{$node->uid}");
drupal_set_breadcrumb($breadcrumb);
}
// Prepare the node content.
if (isset($node->quotes_format) && $node->quotes_format != 'single') {
$quotes = array();
foreach (_quotes_parse_import($node) as $quote) {
$quote->body = check_markup($quote->body, $node->format, FALSE);
$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,
);
}
else {
$max_length = isset($node->max_length) ? $node->max_length : 0;
$node = node_prepare($node);
$node->content['body'] = array(
'#value' => theme('quotes_quote', $node, $teaser, FALSE, $max_length),
'#weight' => 0,
);
}
return $node;
}