hook_comment_validate

  1. drupal
    1. drupal7
Versionen
drupal7 hook_comment_validate(&$form_values)

The user has just finished editing the comment and is trying to preview or submit it. This hook can be used to check or even modify the comment. Errors should be set with form_set_error().

Übergabeparameter

$form_values Passes in an array of form values submitted by the user.

Rückgabewert

Nothing.

Verwandte Themen

Code

modules/comment/comment.api.php, line 37

<?php
function hook_comment_validate(&$form_values) {
  // if the subject is the same as the comment.
  if ($form_values['subject'] == $form_values['comment']) {
    form_set_error('comment', t('you should write more text than in the 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