You are here

function theme_guestbook_form_entry_form in Guestbook 7.2

Same name and namespace in other branches
  1. 5.2 guestbook.module \theme_guestbook_form_entry_form()
  2. 5 guestbook.module \theme_guestbook_form_entry_form()
  3. 6.2 guestbook.module \theme_guestbook_form_entry_form()
  4. 6 guestbook.module \theme_guestbook_form_entry_form()

File

./guestbook.module, line 780

Code

function theme_guestbook_form_entry_form($variables) {
  $form_state = $variables['form'];
  $output = '';

  // @todo Since #access is set on the overall form now, this function along
  // with the switch below is no longer executed.
  $access = $form_state['#access'];
  $display = $form_state['display']['#value'];
  $uid = $form_state['uid']['#value'];
  switch ($access) {
    case 'allowed':
      if ($display == 'link') {

        // Output only a link to a page with the form.
        $output .= '<p>&raquo; ' . l(t('Add guestbook entry'), guestbook_path($uid) . '/sign') . '</p>';
      }
      else {
        $output .= $display == 'page' ? '' : '<h3>' . t('Add guestbook entry') . '</h3>';
        $output .= drupal_render_children($form_state);
      }
      break;
    case 'own guestbook':
      if (isset($form_state['entry_id'])) {
        drupal_set_title(t('Edit guestbook entry'));
        $output .= drupal_render_children($form_state);
      }
      else {
        $output .= ' ';
      }
      break;
    case 'not logged in':
      $output .= '<p class="links">&raquo; ' . t('You must be logged in to post a comment.') . '</p>';
      break;
    case 'not allowed':
      $output .= '<p class="links">&raquo; ' . t('You are not allowed to post in this guestbook.') . '</p>';
      break;
  }
  return $output;
}