Skip to content
Snippets Groups Projects
Commit fe83dcab authored by Damian Lee's avatar Damian Lee Committed by Tim Plunkett
Browse files

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

parent a25e8fed
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -22,16 +22,40 @@ function views_api_version() { ...@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment