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.
Follow code style for complex hooks according to https://www.drupal.org/docs/develop/coding-standards/api-documentation-a... that is add 'for' following by the hook specialisation.
/**
* Implements hook_form_FORM_ID_alter() for node_type_form().
*/
function mymodule_form_node_type_form_alter(&$form, &$form_state) {
Comment | File | Size | Author |
---|---|---|---|
views-complex-hooks.patch | 3.06 KB | clemens.tolboom | |
Comments
Comment #2
clemens.tolboomComment #3
clemens.tolboomComment #4
MartijnBraam CreditAttribution: MartijnBraam as a volunteer commentedComment #5
cilefen CreditAttribution: cilefen commentedIs there a possible way this could be automated?
Comment #6
clemens.tolboom@cilefen what do you mean? As a CS rule or precommit hook? Is there an issue for that?
Comment #7
catchWe should an a CS rule, see #2571965: [meta] Fix PHP coding standards in core for examples. Postponing this on the rule.
Comment #8
clemens.tolboomHmmm ... so we wait till that issue is solved which then can automatically fix this issue? That issue is not moving fast. Why not commit this and other issues right away. Then we can close this and hope #2571965: [meta] Fix PHP coding standards in core will move forward the same time.
Comment #9
clemens.tolboomSoooo I learned from #2571965: [meta] Fix PHP coding standards in core I can run phpcs on views.module
../../../vendor/bin/phpcs -p -s --standard=Drupal views.module
Not sure how to run the sniff Drupal_Sniffs_Commenting_HookCommentSniff only
Comment #10
catch@clemens.tolboom we already have phpcs running on every patch and reporting back (the reporting is still in progress to an extent, eventually it will post patches etc.) - what we don't have yet is either this rule for phpcs, or the rule enabled for core.
phpcs.xml.dist should let you run specific rules one at a time.
Comment #11
clemens.tolboomCreated patch for coder #2890681: Detect complex hooks seperately.
Comment #24
pameeela CreditAttribution: pameeela at Technocrat commentedSeems like a task, but I am not sure whether it's still relevant. Needs an issue summary update to explain the scope and proposed changes I think?