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.
Doxygen and comment formatting conventions suggests that comments for hook implementations should be something like
/**
* Implements hook_help().
*/
function blog_help($section) {
// ...
}
The snippets now use this format and Drupal Code Sniffer issues a warning.
/**
* Implementation of hook_help()
*/
function blog_help($section) {
// ...
}
Attached patch replaces old style comments for the ones suggested in the documentation. With this patch Drupal Code Sniffer doesn't complain about the format of the comments.
Comment | File | Size | Author |
---|---|---|---|
#1 | formatting-conventions-for-hook-snippets-1843240-1.patch | 10.13 KB | benjifisher |
formatting-conventions-for-hook-snippets.patch | 10.13 KB | mpv |
Comments
Comment #1
benjifisher@mpv:
Thanks for the patch!
Five of the hooks already had ending punctuation, and your patch gave them two periods. For example,
+ * Implements hook_init()..
I have applied the attached patch.
I think there are still some whitespace issues with the snippets, but this is a step in the right direction, so I am marking this issue as fixed. If you are interested in submitting further patches, please post them to #1839828: Update and add code snippets.
Already committed: 17e5ae3. It will be included in the next release.
Comment #2
benjifisherI also updated the on-line documentation: http://drupal.org/node/1389006 and http://drupal.org/node/1407302.