Drupal currently has two ways of handling include files: either in /includes or in a module folder. Some modules, however, put their include files in a separate folder and some use a non-standard naming format.
What if we say include files are only allowed within the /includes subfolder of every module. We would get a more consistent file structure and we could rework module_load_include to something simpler:
function drupal_include($name, $module = 'system') {
if (function_exists('drupal_get_path')) {
$file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$module.$name.inc";
}
}
1) This would force all include files to be at a location of the form /includes/$module.$include_name.inc within a module's directory.
2) We can move /includes to /modules/system/includes. However, this would cause namespace problems (we don't want to prefix all functions with system_. I propose System.module is the only module that does not follow the namespace conventions set in Drupal, except for hooks, because it is the absolute core of Drupal.
Why would we do this?
1) Include files can always be found in similar places, namely /includes within a module folder.
2) Easier and cleaner including of those files.
Comments
Comment #1
xanoWe wouldn't need file path properties in hooks (hook_menu(), for instance) anymore either, because optional files are always located in /includes within module directories. DX++.
Comment #2
swentel commentedYou have almost the same one at #1074140: Force include files to be in /path-to-module/includes :)
Comment #3
xanoHeh, probably because I couldn't find it anymore and wasn't sure I added it in the first place. Thanks!