theme_comment_form

Versions
4.6
theme_comment_form($edit, $title)

Code

modules/comment.module, line 1387

<?php
function theme_comment_form($edit, $title) {
  global $user;

  $form .= "<a id=\"comment-form\"></a>\n";

  // contact information:
  if ($user->uid) {
    $form .= form_item(t('Your name'), format_name($user));
  }
  else if (variable_get('comment_anonymous', 0) == 1) {
    $form .= form_textfield(t('Your name'), 'name', $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous') , 20, 60);
    $form .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 20, 64, t('The content of this field is kept private and will not be shown publicly.'));
    $form .= form_textfield(t('Homepage'), 'homepage', $edit['homepage'], 20, 255);
  }
  else if (variable_get('comment_anonymous', 0) == 2) {
    $form .= form_textfield(t('Your name'), 'name', $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous') , 20, 60, NULL, NULL, TRUE);
    $form .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 20, 64, t('The content of this field is kept private and will not be shown publicly.'), NULL, TRUE);
    $form .= form_textfield(t('Homepage'), 'homepage', $edit['homepage'], 20, 255);
  }

  // subject field:
  if (variable_get('comment_subject_field', 1)) {
    $form .= form_textfield(t('Subject'), 'subject', $edit['subject'], 50, 64);
  }

  // comment field:
  $form .= form_textarea(t('Comment'), 'comment', $edit['comment'] ? $edit['comment'] : $user->signature, 70, 10, '', NULL, TRUE);

  // format selector
  $form .= filter_form('format', $edit['format']);

  // preview button:
  $form .= form_hidden('cid', $edit['cid']);
  $form .= form_hidden('pid', $edit['pid']);
  $form .= form_hidden('nid', $edit['nid']);

  $form .= form_submit(t('Preview comment'));

  // Only show post button if preview is optional or if we are in preview mode.
  // We show the post button in preview mode even if there are form errors so that
  // optional form elements (e.g., captcha) can be updated in preview mode.
  if (!variable_get('comment_preview', 1) || ($_POST['op'] == t('Preview comment')) || ($_POST['op'] == t('Post comment'))) {
    $form .= form_submit(t('Post comment'));
  }

  return theme('box', $title, form($form, 'post', url('comment/reply/'. $edit['nid'])));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.