Active
Project:
Drupal core
Version:
main
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2012 at 22:12 UTC
Updated:
10 Sep 2021 at 19:40 UTC
Jump to comment: Most recent
API page: http://api.drupal.org/api/drupal/modules%21system%21theme.api.php/functi...
The hook is declared as:
hook_preprocess_HOOK(&$variables)
while the call made to this hook includes a second parameter whose value is the hook:
hook_preprocess_HOOK(&$variables, $hook)
Based on a quick peek at theme(), this applies to 6.x and 8.x versions too.
Comments
Comment #1
jhodgdonI'm actually not sure where this hook is invoked exactly. I remember figuring that out at one time (last time I updated the theme() docs), but I'm not sure now. I don't see a call in theme() directly...
Comment #2
solotandem commentedThis is the line:
$processor_function($variables, $hook_clone);Comment #3
jhodgdonOK. Sounds like we should add that to the documentation on the theme() page that lists all the hooks that get invoked, and to each of the corresponding hook pages as well. Thanks!
Comment #12
catchLooks like this is still valid, but I really wonder why we pass the hook to a method that obviously knows what $hook is - seems like it might be cruft from when we had hook_preprocess(), so we should consider not passing in the redundant information instead.
Comment #13
catchThis is invoked in ThemeManager::render() and it's still passing the extra variable that's not documented.
I think we should probably document the actual arguments in Drupal 9, but then deprecate the $hook argument for Drupal 10.