devel_generate.inc not included on /admin/generate/content
marcvangend - June 24, 2009 - 19:38
| Project: | Devel |
| Version: | 6.x-1.x-dev |
| Component: | devel_generate |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
In the current 6.x dev version, the devel_generate_content_types function has been moved to devel_generate.inc. I'm not sure why this was changed, so I can't judge what the best solution is. That's why I didn't make a patch for this. Anyway, I was able to do a quick fix by adding these lines to the /admin/generate/content item in devel_generate_menu():
'file' => 'devel_generate.inc',
'file path' => drupal_get_path('module', 'devel'),
#1
Yes, that's annoying. A simple require() seems more fitting here, though.
#2
committed. thx.
#3
Don't want to be too nitpicky, but that require_once relies on a certain PHP config ;)
#4
committed. thx.
#5
Thanks for the fix, guys. I trust you chose the best solution, but can you help me understand some of the things said here?
>> A simple require() seems more fitting here
Why is that? Is the file property on menu items reserved for special cases, or does it have performance drawbacks?
>> require_once relies on a certain PHP config
The other methods discussed ($item['file'] and module_load_include()) both end up using require_once, so what is the difference?
Thanks.
#6
@marcvangend: The difference is that the menu callback itself - devel_generate_users_form[_submit]() - lives in devel_generate.module. So, registering it in the menu system to be pseudo-located in devel_generate.inc to get some sort of auto-loading for the include file would not be correct technically.
#7
@sun: That's funny, I always interpreted the file property as an auto loading mechanism for include files (exactly like you say), not necessarily as the location of the callback function. Thanks for the explanation.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.