Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Mar 2014 at 09:48 UTC
Updated:
29 Jul 2014 at 23:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedClarified the parameter $alter_hook by adding an example definition
Comment #2
JayeshSolanki commentedComment #3
berdirThis is exactly the same behavior as drupal_alter()/ModuleHandlerInterface::alter() always has been, so maybe we should just reference to that?
Comment #4
jhodgdonThanks for the patch!
I would agree with #3, but this documentation is very short, so I think rather than *just* referencing it, we should go ahead and provide the docs, and also provide an @see link to ModuleHandlerInterface::alter().
Also, regardin the current patch:
- "Example" should not be capitalized in "For Example".
- Please do not use "foobar". Use a more representative hook name, like hook_mymodule_mydata_alter().
- In place of "to use", you might use wording like "If your alter hook is called...".
- In place of "you want to pass only", you might use more concise wording that tells what to do, such as just "pass in".
Comment #5
longwave"mymodule_data" is the example used in ModuleHandlerInterface, so let's borrow that here.
Comment #6
longwaveOr should we rename the parameter to make it more obvious it isn't just the hook name, like ModuleHandlerInterface does?
Comment #7
jhodgdonThe docs there look good. The first comma (before "for example") should be a ; though.
Changing the parameter would be OK, but it looks like $type is the same parameter name as ModuleHandlerInterface::alter($type)?
Hmmm... Can the $type here be an array?
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ModuleH...
If so, I think we should definitely make a link to ModuleHandlerInterface::alter()... it seems unlikely for plugin managers that they would want to use an array though?
Comment #8
Anonymous (not verified) commentedHi I added a patch taking care of your recommendations hook_mymodule_data_alter()
Comment #9
jhodgdonGood but needs a space after the ; -- thanks! Also, neither "for" nor "example" should be capitalized, since they are in the middle of a sentence.
Comment #10
Anonymous (not verified) commentedComment #11
Anonymous (not verified) commentedComment #12
jhodgdonThanks, that should do it.
Comment #13
longwaveThere is a typo in #10, "mymodula_data"
Comment #14
Anonymous (not verified) commented@longwave Thanks for pointing out
Comment #15
Anonymous (not verified) commentedComment #16
jhodgdonDoh! Missed that. Looks good this time. :)
Comment #17
jhodgdonThanks again! Committed to 8.x.