Hello everyone,

I found that there are several calls to module_load_include() in the hook menu() that could be simplified using file and and file path properties instead.
E.g.:

  $first_install = variable_get(PATTERNS_FIRST_INSTALL, TRUE);
  if ($first_install) {
    module_load_include('inc', 'patterns', 'includes/forms/first_install');
 
    $items['admin/patterns'] = array(
      'title' => 'Patterns',
      'description' => 'Patterns was just installed or important updates have been found',
      'page callback' => 'patterns_first_install_page',
      'access arguments' => array('administer patterns'),
    );
 
    return $items;
  }

could be replaced by:

 //This is just a draft!. Code has not been tested!.
  $first_install = variable_get(PATTERNS_FIRST_INSTALL, TRUE);
  if ($first_install) {
    module_load_include('inc', 'patterns', 'includes/forms/first_install');
 
    $items['admin/patterns'] = array(
      'title' => 'Patterns',
      'description' => 'Patterns was just installed or important updates have been found',
      'page callback' => 'patterns_first_install_page',
      'access arguments' => array('administer patterns'),
      'file' => 'first_install.inc',
      'file path' => drupal_get_path('patterns', 'inc'),
    );
 
    return $items;
  }

The main advantage is that makes easier to track the original file the called functions belong to (more info at: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...)

I will create a branch of the code at github, take a look at it and provide a patch if everything is ok.

Cheers,

David

Comments

drozas’s picture

Status: Needs work » Active
drozas’s picture

Status: Active » Closed (won't fix)

This will be gathered in the new release.