function theme_guestbook in Guestbook 7.2
Same name and namespace in other branches
- 5.2 guestbook.module \theme_guestbook()
- 5 guestbook.module \theme_guestbook()
- 6.2 guestbook.module \theme_guestbook()
- 6 guestbook.module \theme_guestbook()
Render a guestbook.
1 theme call to theme_guestbook()
- guestbook_page in ./
guestbook.module - Output a guestbook page; menu callback.
File
- ./
guestbook.module, line 902
Code
function theme_guestbook($variables) {
global $user;
$uid = $variables['uid'];
$entries = $variables['entries'];
$comment_entry = $variables['comment_entry'];
$limit = $variables['limit'];
$form_location = variable_get('guestbook_form_location', 'above');
$pager_position = variable_get('guestbook_pager_position', GUESTBOOK_PAGER_BELOW);
// Intro text.
$intro = _guestbook_info($uid, 'intro');
$output = $intro ? check_markup($intro, NULL, '', TRUE) : '';
if ($_GET['q'] != 'user/' . $uid) {
$output .= _guestbook_user_profile_link($uid);
}
// Form on separate page.
if ($form_location == 'separate page') {
$build = guestbook_form_entry($uid, 'link');
$output .= drupal_render($build);
}
// Form and pager above entries.
if ($form_location == 'above') {
$build = guestbook_form_entry($uid);
$output .= drupal_render($build);
}
$output .= $pager_position & GUESTBOOK_PAGER_ABOVE ? theme('pager') : '';
$i = 0;
foreach ($entries as $entry) {
$zebra = $i % 2 ? 'odd' : 'even';
$output .= theme('guestbook_entry', array(
'uid' => $uid,
'entry' => $entry,
'comment_entry' => $comment_entry,
'zebra' => $zebra,
));
$i++;
}
// Form and pager below entries.
$output .= $pager_position & GUESTBOOK_PAGER_BELOW ? theme('pager') : '';
if ($form_location == 'below') {
$build = guestbook_form_entry($uid);
$output .= drupal_render($build);
}
if ($output == '') {
$output = '<div class="guestbook-empty">' . t('Nobody has signed this guestbook yet.') . '</div>';
}
return '<div class="guestbook">' . $output . "</div>\n";
}