Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Jan 2009 at 18:17 UTC
Updated:
29 Jul 2014 at 18:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Crell commentedMonths ago I proposed using an _info() suffix to indicate registry hooks. I believe the full proposal included a definition of:
- Had a _info() suffix.
- Returned an associative array that gets merged between all hooks.
- Had a corresponding alter hook.
- Was cached somehow so that the hook would be called only once in a blue moon. (Originally I said cached somewhere other than the cache tables as a big blob, but I think that's proven too strict a requirement.)
So we'd have:
hook_block_info()
hook_router_info() (replaces hook_menu())
hook_permission_info()
hook_theme_info()
hook_field_info() (maps to hook_content_field_info() in CCK)
hook_field_formatter_info() (maps to hook_content_field_formatter_info() in CCK)
// Various other existing CCK hooks
hook_views_tables_info() (replaces hook_views_data())
And so on. Let's go with the setup we already are beginning to establish with _info().
Comment #2
dropcube commentedComment #3
dropcube commentedWe already have:
hook_action_info
hook_action_info_alter
hook_aggregator_fetch_info
hook_aggregator_parse_info
hook_aggregator_process_info
hook_block_info
hook_block_info_alter
hook_entity_info
hook_entity_info_alter
hook_field_formatter_info
hook_field_formatter_info_alter
hook_field_info
hook_field_info_alter
hook_field_widget_info
hook_field_widget_info_alter
hook_filter_info
hook_filter_info_alter
hook_image_effect_info
hook_node_info
hook_search_info
#572932: Rename hook_elements() to hook_element_info()
For consistency, we should rename:
hook_permission() => hook_permission_info()
hook_theme() => hook_theme_info()
hook_theme_registry_alter() => hook_theme_info_alter()
hook_menu() => hook_menu_info()
hook_menu_alter() => hook_menu_info_alter()
Any others?
Comment #4
webchickComment #5
brianV commentedThis is a logical change. It's also a simple one, although a lot of work.
Marking as a novice task:
1. Update all the implementations of the above hooks to match the suggested names..
2. Find all invocations of the above hooks via module_invoke() or module_invoke_all(), and change the passed hook name parameters.
Comment #6
lirantal commented@dropcube have you started work on this or may I take this one?
Comment #7
Crell commentedEh, most of these hooks are turning into either CMI or Plugins at this point, or should be, so I don't know that it's still useful to bother with. A lot has happened in 3 years. :-)
Comment #8
lirantal commentedIt seems that hook_permission out of the small list of functions to rename from #3 is the only one that is still relevant (in D8).
So whats the take on this then?
Comment #9
Crell commentedhook_permission_info() would be fine by me, but I don't know if it's still doable in our current dev phase.
Comment #10
lirantal commentedWell if it is then I'll get on with it.
What say you?
Comment #11
reszliComment #12
reszliattached is a first patch for the permission hook
updated the following function names / calls / comments
+ hook_permission()
+ getImplementations('permission'
+ implementsHook(module, 'permission')
+ invoke(module, 'permission', ...
+ invokeAll('permission', ...
to all use permission_info
Comment #14
visabhishek commentedUpdated function for some remaining places
+ hook_permission()
+ implementsHook(module, 'permission')
Comment #16
tstoecklerRe-titling this issue for the current purpose.
Apart from this super minor nitpick, the patch looks great. If that little thing is fixed this is RTBC.
These should be re-formatted to fit into 80 chars.
Comment #17
tstoecklerOops, apparently needs to be re-rolled first. Now re-titling for reals.
Comment #18
visabhishek commentedupdated patch
Comment #19
visabhishek commentedChanging the status for review...
Comment #20
webchickHm. I'm not super crazy about this, personally. "info" hooks have largely gone away in favour of plugins in D8, and the ones that are left are "hook_theme()," "hook_schema()," "hook_mail()," etc. In other words, hook_permission() currently is consistent with the remaining "registry" hooks that are in D8, and I'm not sure there's a huge DX win to justify the BC break in renaming them all to something else.
Comment #22
tstoecklerHmm.., what about $modulename.permissions.yml then?
Comment #23
visabhishek commenteddo i need to update my patch or stop for now ?
Comment #24
tstoecklerHmm... sadly I think unless we can think of a different approach (I'm not too fond of #22 myself, although it's certainly better than in info hook in my book) *and* rally some people to support this, there is not much point in continuing with this.
I really want to argue against #20 because it feels wrong and hook_*_info() feels right, but there is really not much to argue. Both the current consistency with hook_mail(), etc. and the fact that we probably shouldn't rename *all* of them.
:-/
Comment #25
reszliComment #26
Crell commentedGoing out on a limb, unfortunately.
Comment #27
effulgentsia commented#2295469: Add support for static permission definitions with *.permissions.yml