API page: http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo...
The attached code on the "hook_theme_registry_alter" documentation page, under the context "developer/hooks/core.php, line 2205" has either a typo or a rather illogical if statement in it's foreach.
$value = 'template_preprocess_forum_topic_navigation'
Which probably should be:
$value == 'template_preprocess_forum_topic_navigation'
Comment | File | Size | Author |
---|---|---|---|
#13 | hook_theme_registry_alter-1312178-13.patch | 680 bytes | drupal_was_my_past |
#10 | hook_theme_registry_alter-1312178-3.patch | 700 bytes | jhodgdon |
#8 | hook_theme_registry_alter-1312178-8.patch | 995 bytes | drupal_was_my_past |
#3 | hook_theme_registry_alter-1312178-3.patch | 700 bytes | drupal_was_my_past |
Comments
Comment #1
jhodgdonGood catch! Good project for a novice patch contributor to fix.
Comment #2
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedWorking on this at BADCamp.
Comment #3
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedPatch attached!
Also the Drupal 8 API pate is at: http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...
Comment #4
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedShould this also be tagged for backport to D6 since the error is appearing in the D6 API also?
Comment #5
jhodgdonThanks for the patch, looks good -- and yes it needs to be tagged for d6 backport.
Comment #6
catchThanks! Committed and pushed to 8.x, moving to 7.x.
Comment #7
Alan D. CreditAttribution: Alan D. commentedFollowup from #1316774: Documentation problem with hook_theme_registry_alter, this code assumes that the forum module is installed. If it isn't, then the code will generate errors. How pedantic should we be about these code examples? This is much less readable.
ie: A real life example would be:
Comment #8
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedOk @Alan D, I think that makes sense. Here is a re-rolled patch for 8.x with the if check.
Comment #9
catchThat change looks fine but please move this to another issue so we don't need to version ping ping this one.
Comment #10
jhodgdonNote: Ignore the patch in #8. I'm reattaching the 7.x patch that is the one that is RTBC for 7.x.
We have lots of hook examples that use various core modules that may or may not be enabled on any given site. They are only meant to be models, so this is OK.
Comment #11
webchickCommitted and pushed to 7.x. Great find! :)
Comment #12
jhodgdonThis one's marked backport to d6.
Comment #13
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedHere's the D6 patch for review.
Comment #15
jhodgdonSorry! I forgot to move this into the Documentation project. The d6 hook docs live in this project's git repository. The patch needs to be rerolled.
Comment #16
sven.lauer CreditAttribution: sven.lauer commentedThe patch in #13 is actually fine---it was rolled against the Documentation repository. The testbot got triggered because the issue itself was still set to core.
The patch applies fine and does the right thing (and is fairly minimal), RTBCing.
Comment #17
jhodgdoncommitted and pushed.