You are here

function workbench_access_load_include in Workbench Access 7

Load a Workbench Access module file, or all files.

@TODO: Allow loading from outside the module directory. However, this should be convered by the magic loading from hook_hook_info() and the registry system.

Parameters

$module: The name of the module file to load.

8 calls to workbench_access_load_include()
WorkbenchAccessMenuTestCase::testWorkbenchAccessMenu in tests/workbench_access.test
workbench_access_access_scheme_load in ./workbench_access.module
Load callback to load information about an access scheme.
workbench_access_get_active_tree in ./workbench_access.module
Load the active tree.
workbench_access_init in ./workbench_access.module
Implements hook_init().
workbench_access_load in ./workbench_access.module
Return information for an access id.

... See full list

File

./workbench_access.module, line 331
Workbench Access module file.

Code

function workbench_access_load_include($module = NULL) {
  if (!is_null($module)) {
    $file = DRUPAL_ROOT . DIRECTORY_SEPARATOR . drupal_get_path('module', 'workbench_access') . '/modules/' . $module . '.workbench_access.inc';
    if (file_exists($file)) {
      include_once $file;
    }
    else {
      watchdog('workbench_access', 'Failed to load required include file %file', array(
        '%file' => $file,
      ), WATCHDOG_ERROR);
    }
    return;
  }

  // Load all includes.
  foreach (file_scan_directory(DRUPAL_ROOT . DIRECTORY_SEPARATOR . drupal_get_path('module', 'workbench_access') . '/modules', '/.inc$/') as $file) {
    include_once $file->uri;
  }
}