_comment_form_submit

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 _comment_form_submit(&$comment_values)

Prepare a comment for submission.

Übergabeparameter

$comment_values An associative array containing the comment data.

▾ 2 functions call _comment_form_submit()

comment_form_add_preview in modules/comment/comment.module
Form builder; Generate and validate a comment preview form.
comment_form_submit in modules/comment/comment.module
Process comment form submissions; prepare the comment, store it, and set a redirection target.

Code

modules/comment/comment.module, line 1509

<?php
function _comment_form_submit(&$comment_values) {
  $comment_values += array('subject' => '');
  if (!isset($comment_values['date'])) {
    $comment_values['date'] = 'now';
  }
  $comment_values['timestamp'] = strtotime($comment_values['date']);
  if (isset($comment_values['author'])) {
    $account = user_load(array('name' => $comment_values['author']));
    $comment_values['uid'] = $account->uid;
    $comment_values['name'] = $comment_values['author'];
  }
  // Validate the comment's subject. If not specified, extract
  // one from the comment's body.
  if (trim($comment_values['subject']) == '') {
    // The body may be in any format, so we:
    // 1) Filter it into HTML
    // 2) Strip out all HTML tags
    // 3) Convert entities back to plain-text.
    // Note: format is checked by check_markup().
    $comment_values['subject'] = truncate_utf8(trim(decode_entities(strip_tags(check_markup($comment_values['comment'], $comment_values['format'])))), 29, TRUE);
    // Edge cases where the comment body is populated only by HTML tags will
    // require a default subject.
    if ($comment_values['subject'] == '') {
      $comment_values['subject'] = t('(No subject)');
    }
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen