ah, thats the other thing that annoyed me. this derogatory term "magic". larry commented in the issue that module developers need full control over function naming and so on. this is laughable. drupal already has strict conventions for function naming - the hook system. my proposal is more of the same, except is is a convenience not a requirement. these are *conventions*, not magic. conventions are powerful, and are popular in many apps like drupal and rails. "we have so much legacy code". all that code is not affected until you start splitting up your module into .inc files. this is a moot point. we can keep the include element if people want to, so they can include random files. that will solve the desire to put an export_ function in the admin file. this isn't just about the menu system. i think we've hurt interoperability of modules with larry's patch. i think modules are going to have to start including each others files in order to get the features they want. thats dirty. it shouldn't happen, but it will. my proposal gets us past that. all a module developer has to do is use module_invoke(<other module>, <function>) and the right includes will happen. this isn't foolproof, but i do think it is an improvement. Peter Wolanin wrote:
This seems like a little too much "magic" in terms of the file and function naming, and perhaps too rigid as well. What if I want to include both admin and export function in one .inc file?
-Peter
On 6/11/07, Moshe Weitzman <weitzman@tejasa.com> wrote:
you do so based on the first part of the function. so in my example below, 'admin' is the part and thus system.admin.inc is known. sorry, i omitted that. it was buried in the issue where larry added the include parameter. that file would only be included if it existed, of course.
Peter Wolanin wrote:
Moshe - how does this make sense? You no longer know which file to include for the callback.
-Peter
On 6/11/07, Moshe Weitzman <weitzman@tejasa.com> wrote:
CURRENT $items['admin/build'] = array( 'title' => 'Site building', 'page callback' => 'system_admin_menu_block_page', 'file' => 'system.admin.inc',
PROPOSED $items['admin/build'] = array( 'title' => 'Site building', 'page callback' => array('system, 'admin_menu_block_page'), (
Note that we may still have to support a string as a page callback (i think) for non module defined callbacks.