Use .info file tags[] to categorize a module as developer module
designerbrent - November 4, 2009 - 19:56
| Project: | Administration menu |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I'm wondering if we can add "reroute_email" as a Developer module that can be disabled via the 1 click disable in the admin_menu? I've attached a patch that does this.
reroute_email is only something that you would want running on a dev site so it would be nice to have a simple way to disable it.
| Attachment | Size |
|---|---|
| admin_menu_add_reroute_email.diff | 219 bytes |

#1
It is starting to get messy.
Instead of doing that, let's simply turn this into a hook.
#2
Crazy idea...let's have people put developer = TRUE in their module's info.files.
#3
Actually, I thought of that too while implementing the hook. ;)
But would it be better?
#4
I could this having much more re-use for other things than an admin_menu_developer_modules hook. Of course in the meantime, admin_menu could implement admin_menu_system_info_alter() for the specified modules. Also if the module has specified package = Development, it should be included.
#5
tags[] = developertags[] = administration
tags[] = ...
? :)
#6
Heh, yeah, it would be nice if module's .info and project pages on d.org were better linked, this approach probably makes the most sense.
#7
So this is what it would look like.
#8
Better title.
#9
Hey, that could make sense! The project groupings in .info have always been a little ad-hoc.
Not quite sure what to use them for yet, but it looks like fun.
#10
Yeah, this is a great approach. Doesn't require us to hard-code all modules, and maybe we can help get a jump start on improving the module page as well as integration with drupal.org project pages. I was thinking about also checking
substr($module->name, -3) === '_ui'but that might be a little over the top.A few modules (at least the ones I know about) we shouldn't need to include in the admin_menu_system_info_alter() since they already use the package 'Development':
coder
demo
devel
devel_node_access
devel_themer
Overall, ++++++++++100 to this and doing it sooner than later.
#11
This looks like a great addition. Thanks for making it so versatile.
#12
+++ admin_menu.inc 4 Nov 2009 23:46:47 -0000@@ -277,6 +268,28 @@ function admin_menu_theme_settings() {
+function admin_menu_developer_modules() {
+ $modules = array();
+ $result = db_query("SELECT name, info FROM {system} WHERE type = 'module'");
+ foreach ($result as $module) {
+ $info = unserialize($module->info);
+ // Add all modules in the "Development" package.
+ if (isset($info['package']) && $info['package'] == 'Development') {
+ $modules[$module->name] = $info['name'];
+ }
+ // Add all modules tagged with "development".
+ if (isset($info['tags']) && is_array($info['tags']) && in_array('development', $info['tags'])) {
+ $modules[$module->name] = $info['name'];
+ }
+ }
+ // Sort by human-readable module name.
+ asort($modules);
+ return $modules;
+}
I wonder whether we should consider to put a function like that as a last-minute attempt into Drupal 7 core.
Of course, without the wishy-washy package name checking. But very possible also supporting simple info variables, i.e. strings. And taking the thing to search for as argument.
That would allow us to retrieve, for example, a list of all hidden modules, or all required modules, or all modules in a certain package.
module_list_by_info($search = 'hidden', $parent = NULL);Filter by tag:
module_list_by_info($search = 'development', $parent = 'tags');Oh, and of course, also search for modules having a certain dependency:
module_list_by_info($search = 'views', $parent = 'dependencies');I'm on crack. Are you, too?
Yes, I am. :)
#13
So let's try it!
#624848: Allow to retrieve a list of modules defining a certain .info file property
#14
I badly need some more traction/discussion/feedback/support in #624848: Allow to retrieve a list of modules defining a certain .info file property, so please comment over there to help flesh out the core version of this function.