diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-06-21 02:27:47 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-06-21 02:27:47 +0000 |
commit | ce19c671106df767202972d22736db3582f6423b (patch) | |
tree | d25953ac2bf8c151c422cec3419273bf259f0f8e /modules/system | |
parent | 34dbad55c589b8c1f3c3fc1eadfb88d989516695 (diff) | |
download | brdo-ce19c671106df767202972d22736db3582f6423b.tar.gz brdo-ce19c671106df767202972d22736db3582f6423b.tar.bz2 |
#293223 follow-up by David_Rothstein: Roll back 'Hide required core modules'. This was removing useful information to both new and experienced site builders, as well as hiding critical 'help' links.
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.admin.inc | 12 | ||||
-rw-r--r-- | modules/system/system.module | 6 | ||||
-rw-r--r-- | modules/system/system.test | 17 |
3 files changed, 30 insertions, 5 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 32490fee2..152d2982c 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -828,7 +828,7 @@ function system_modules($form, $form_state = array()) { // Remove hidden modules from display list. $visible_files = $files; foreach ($visible_files as $filename => $file) { - if (!empty($file->info['hidden']) || !empty($file->info['required'])) { + if (!empty($file->info['hidden'])) { unset($visible_files[$filename]); } } @@ -849,10 +849,19 @@ function system_modules($form, $form_state = array()) { // Used when checking if module implements a help page. $help_arg = module_exists('help') ? drupal_help_arg() : FALSE; + // Used when displaying modules that are required by the install profile. + require_once DRUPAL_ROOT . '/includes/install.inc'; + $distribution_name = check_plain(drupal_install_profile_distribution_name()); + // Iterate through each of the modules. foreach ($visible_files as $filename => $module) { $extra = array(); $extra['enabled'] = (bool) $module->status; + if (!empty($module->info['required'] )) { + $extra['disabled'] = TRUE; + $extra['required_by'][] = $distribution_name; + } + // If this module requires other modules, add them to the array. foreach ($module->requires as $requires => $v) { if (!isset($files[$requires])) { @@ -929,6 +938,7 @@ function system_modules($form, $form_state = array()) { } $form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra); } + // Add basic information to the fieldsets. foreach (element_children($form['modules']) as $package) { $form['modules'][$package] += array( diff --git a/modules/system/system.module b/modules/system/system.module index 338d6ab8c..d8ad21f16 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2263,6 +2263,12 @@ function _system_rebuild_module_data() { // Merge in defaults and save. $modules[$key]->info = $module->info + $defaults; + // Install profiles are hidden by default, unless explicitly specified + // otherwise in the .info file. + if ($key == $profile && !isset($modules[$key]->info['hidden'])) { + $modules[$key]->info['hidden'] = TRUE; + } + // Invoke hook_system_info_alter() to give installed modules a chance to // modify the data in the .info files if necessary. $type = 'module'; diff --git a/modules/system/system.test b/modules/system/system.test index c3aced017..f1a4407a7 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -364,11 +364,20 @@ class ModuleRequiredTestCase extends ModuleTestCase { * Assert that core required modules cannot be disabled. */ function testDisableRequired() { - $required_modules = drupal_required_modules(); + $module_info = system_get_info('module'); $this->drupalGet('admin/modules'); - foreach ($required_modules as $module) { - // Check to make sure the checkbox for required module is not found. - $this->assertNoFieldByName('modules[Core][' . $module . '][enable]'); + foreach ($module_info as $module => $info) { + // Check to make sure the checkbox for each required module is disabled + // and checked (or absent from the page if the module is also hidden). + if (!empty($info['required'])) { + $field_name = "modules[{$info['package']}][$module][enable]"; + if (empty($info['hidden'])) { + $this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', t('Field @name was disabled and checked.', array('@name' => $field_name))); + } + else { + $this->assertNoFieldByName($field_name); + } + } } } } |