Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hook_comment_validate() is a relic of old times. Module developers should add their #validate handlers to the comment form using hook_form_alter(). They don't need to be confused with a dedicated hook for that.
Comment | File | Size | Author |
---|---|---|---|
#1 | 512492-remove-hook-comment-validate.patch | 1.67 KB | Damien Tournoud |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedHere we are.
Comment #2
Dries CreditAttribution: Dries commentedLiked it. Committed it.
Let's update the documentation in the handbook though.
Thanks!
Comment #3
brianV CreditAttribution: brianV commentedDamz,
was the documentation added to the handbook? Should this be closed?
Comment #4
catchLooks like it http://drupal.org/update/modules/6/7#comment_validate_removed
Comment #6
joachim CreditAttribution: joachim commentedNeeds a mention in the 6-7 conversion guide, presumably.
Comment #7
mattyoung CreditAttribution: mattyoung commentedRemoving this hook unfortunately means we do not have any API doc to lookup on how to properly write a comment validate function. There are some not easily knowable things that you need to handle to write code that works 100% of times. We should have this hook back to document them so people can easily find this info.
See #20 of #813052: Undefined index: format in comment_preview line 2065 and line 2183.
The same needs to be documented for the hook_node_XXX() hooks.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedThere is no point is getting hook_comment_validate() back from its grave. In Drupal 7, you don't write custom extensions to comments, you write field handlers. Let's get this issue back to rest.