function theme_quotes_quote in Quotes 6
Same name and namespace in other branches
- 5 quotes.module \theme_quotes_quote()
- 7 quotes.module \theme_quotes_quote()
Themeable function that displays a single quote and optional author.
Parameters
$node: The node object containing the quote body and author.
$teaser: Boolean to indicate whether to use the teaser or the body.
$bio: Boolean to indicate whether to use the author's biography.
$max_length: Integer to limit the quote length in a block.
Return value
An HTML-formatted quote.
1 theme call to theme_quotes_quote()
- quotes_view in ./
quotes.module - Implementation of hook_view().
File
- ./
quotes.module, line 1179 - 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 theme_quotes_quote($node, $teaser = FALSE, $bio = TRUE, $max_length = 0) {
global $user;
if ($max_length) {
// We want to limit the text.
$text = node_teaser($node->body, $node->format, $size = $max_length);
if (drupal_strlen($text) < drupal_strlen($node->body)) {
$text .= '…' . l(t('(more)'), drupal_get_path_alias('node/' . $node->nid));
}
}
else {
$text = $teaser ? $node->teaser : $node->body;
}
$body = check_markup($text, $node->format, FALSE);
$leader = variable_get('quotes_leader', '—') . ' ';
if (arg(1) == 'author') {
$show_bio = FALSE;
}
else {
$show_bio = variable_get('quotes_author_bio', FALSE);
}
$format = variable_get('quotes_format', 0);
$format = $format ? $format : $node->format;
if (variable_get('quotes_author_link', FALSE)) {
$author = $node->quotes_author ? $leader . l($node->quotes_author, 'quotes/author/' . $node->quotes_author, array(
'title' => t('View all quotes by this author'),
)) : '';
$author = decode_entities($author);
}
else {
$author = $node->quotes_author ? check_markup($leader . $node->quotes_author, $format, FALSE) : '';
}
switch ($show_bio) {
case 1:
$bio = $node->quotes_bio ? '<div class="quotes-bio">' . check_markup($node->quotes_bio, $format, FALSE) . '</div>' : '';
break;
case 2:
$menu_info = menu_get_item('quotes');
$menu_title = drupal_strtolower($menu_info['title']);
$bio = $node->quotes_author ? '<div class="quotes-bio-link">' . l(t('See biography and !menu', array(
'!menu' => $menu_title,
)), 'quotes/author/' . $node->quotes_author, array(
'title' => t('View all quotes by this author'),
)) . '</div>' : '';
break;
default:
$bio = '';
}
$citation = $node->quotes_citation ? check_markup("<cite>" . $node->quotes_citation . "</cite>", $format, FALSE) : '';
return '<div class="quotes-quote">' . $body . '</div>' . ($author ? '<div class="quotes-author">' . $author . '</div>' : '') . $bio . ($citation ? '<div class="quotes-citation">' . $citation . '</div>' : '') . '<div class="clear-block"></div>';
}