function autoload_paths in Autoload 7
Collect autoloading maps.
Return value
array[] An array of arrays, keyed by base of the namespace.
2 calls to autoload_paths()
- autoload_paths_recompute in ./
autoload.module - Recompute autoload paths.
- autoload_seek_classes in ./
autoload.module - Seek classes by base of a namespace.
1 string reference to 'autoload_paths'
- autoload_paths_recompute in ./
autoload.module - Recompute autoload paths.
File
- ./
autoload.module, line 82
Code
function autoload_paths() {
$processed =& drupal_static(__FUNCTION__, FALSE);
static $map = array();
if (!$processed) {
$processed = TRUE;
foreach (system_list('module_enabled') as $module_name => $data) {
if (!empty($data->info['autoload'])) {
$module_path = dirname($data->filename);
// Allow "autoload = whatever" to enable Drupal-way namespaces.
if (!is_array($data->info['autoload'])) {
// @see simpletest_test_get_all()
$data->info['autoload'] = array_fill_keys(array(
"lib/Drupal/{$module_name}",
'src',
), array(
"Drupal\\{$module_name}",
));
}
foreach ($data->info['autoload'] as $subdirectory => $namespaces) {
if (!is_array($namespaces)) {
continue;
}
$path = rtrim("{$module_path}/{$subdirectory}", '/');
if (file_exists($path)) {
foreach ($namespaces as $namespace) {
$parts = explode('\\', $namespace);
$map[$parts[0]][$path] = array(
'name' => $module_name,
'path' => $module_path,
// If parts of namespace more than one, then
// we dealing with PSR-4 autoloading standard.
// Trailing slash is needed to remove it from path later.
'psr-4' => count($parts) > 1 ? autoload_namespace_to_path($namespace) : '',
);
}
}
}
}
}
}
return $map;
}