Issue #1751282 by damiankloip: Create helper function to get list of core modules.

8.0.x
damiankloip 2012-08-25 13:40:18 +02:00 committed by Tim Plunkett
parent a25e8fedfb
commit fe83dcab18
1 changed files with 26 additions and 2 deletions

View File

@ -22,16 +22,40 @@ function views_api_version() {
return '3.0'; return '3.0';
} }
/**
* Returns a list of Drupal core modules.
*
* @return array
*/
function views_core_modules() {
return array(
'aggregator',
'book',
'comment',
'contact',
'field',
'filter',
'file',
'locale',
'node',
'search',
'statistics',
'system',
'taxonomy',
'translation',
'user'
);
}
/** /**
* Implements hook_init(). * Implements hook_init().
* *
* *
*/ */
function views_init() { function views_init() {
$core_modules = array('aggregator', 'book', 'comment', 'contact', 'field', 'filter', 'file', 'locale', 'node', 'search', 'statistics', 'system', 'taxonomy', 'translation', 'user');
$path = drupal_get_path('module', 'views'); $path = drupal_get_path('module', 'views');
$loader = drupal_classloader(); $loader = drupal_classloader();
foreach ($core_modules as $module) { foreach (views_core_modules() as $module) {
$function = $module . '_views_api'; $function = $module . '_views_api';
if (function_exists($function)) { if (function_exists($function)) {
$loader->registerNamespace('Views\\' . $module, DRUPAL_ROOT . '/' . $path . '/lib'); $loader->registerNamespace('Views\\' . $module, DRUPAL_ROOT . '/' . $path . '/lib');