Commit ce19c671 authored by webchick's avatar webchick

#293223 follow-up by David_Rothstein: Roll back 'Hide required core modules'....

#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.
parent 34dbad55
...@@ -187,8 +187,18 @@ function drupal_set_installed_schema_version($module, $version) { ...@@ -187,8 +187,18 @@ function drupal_set_installed_schema_version($module, $version) {
* @see install_profile_info() * @see install_profile_info()
*/ */
function drupal_install_profile_distribution_name() { function drupal_install_profile_distribution_name() {
global $install_state; // During installation, the profile information is stored in the global
return $install_state['profile_info']['distribution_name']; // installation state (it might not be saved anywhere yet).
if (drupal_installation_attempted()) {
global $install_state;
return $install_state['profile_info']['distribution_name'];
}
// At all other times, we load the profile via standard methods.
else {
$profile = drupal_get_profile();
$info = install_profile_info($profile);
return $info['distribution_name'];
}
} }
/** /**
......
; $Id$ ; $Id$
name = Field name = Field
description = Field API to add fields to entities like nodes and users. description = Field API to add fields to entities like nodes and users.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[] = field.module files[] = field.module
......
; $Id$ ; $Id$
name = Field SQL storage name = Field SQL storage
description = Stores field data in an SQL database. description = Stores field data in an SQL database.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[] = field_sql_storage.module files[] = field_sql_storage.module
......
; $Id$ ; $Id$
name = List name = List
description = Defines list field types. Use with Options to create selection lists. description = Defines list field types. Use with Options to create selection lists.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[]=list.module files[]=list.module
......
; $Id$ ; $Id$
name = Number name = Number
description = Defines numeric field types. description = Defines numeric field types.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[]=number.module files[]=number.module
......
; $Id$ ; $Id$
name = Options name = Options
description = Defines selection, check box and radio button widgets for text and numeric fields. description = Defines selection, check box and radio button widgets for text and numeric fields.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[]=options.module files[]=options.module
......
; $Id$ ; $Id$
name = Text name = Text
description = Defines simple text field types. description = Defines simple text field types.
package = Core - fields package = Core
version = VERSION version = VERSION
core = 7.x core = 7.x
files[] = text.module files[] = text.module
......
...@@ -828,7 +828,7 @@ function system_modules($form, $form_state = array()) { ...@@ -828,7 +828,7 @@ function system_modules($form, $form_state = array()) {
// Remove hidden modules from display list. // Remove hidden modules from display list.
$visible_files = $files; $visible_files = $files;
foreach ($visible_files as $filename => $file) { foreach ($visible_files as $filename => $file) {
if (!empty($file->info['hidden']) || !empty($file->info['required'])) { if (!empty($file->info['hidden'])) {
unset($visible_files[$filename]); unset($visible_files[$filename]);
} }
} }
...@@ -849,10 +849,19 @@ function system_modules($form, $form_state = array()) { ...@@ -849,10 +849,19 @@ function system_modules($form, $form_state = array()) {
// Used when checking if module implements a help page. // Used when checking if module implements a help page.
$help_arg = module_exists('help') ? drupal_help_arg() : FALSE; $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. // Iterate through each of the modules.
foreach ($visible_files as $filename => $module) { foreach ($visible_files as $filename => $module) {
$extra = array(); $extra = array();
$extra['enabled'] = (bool) $module->status; $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. // If this module requires other modules, add them to the array.
foreach ($module->requires as $requires => $v) { foreach ($module->requires as $requires => $v) {
if (!isset($files[$requires])) { if (!isset($files[$requires])) {
...@@ -929,6 +938,7 @@ function system_modules($form, $form_state = array()) { ...@@ -929,6 +938,7 @@ function system_modules($form, $form_state = array()) {
} }
$form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra); $form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra);
} }
// Add basic information to the fieldsets. // Add basic information to the fieldsets.
foreach (element_children($form['modules']) as $package) { foreach (element_children($form['modules']) as $package) {
$form['modules'][$package] += array( $form['modules'][$package] += array(
......
...@@ -2263,6 +2263,12 @@ function _system_rebuild_module_data() { ...@@ -2263,6 +2263,12 @@ function _system_rebuild_module_data() {
// Merge in defaults and save. // Merge in defaults and save.
$modules[$key]->info = $module->info + $defaults; $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 // Invoke hook_system_info_alter() to give installed modules a chance to
// modify the data in the .info files if necessary. // modify the data in the .info files if necessary.
$type = 'module'; $type = 'module';
......
...@@ -364,11 +364,20 @@ class ModuleRequiredTestCase extends ModuleTestCase { ...@@ -364,11 +364,20 @@ class ModuleRequiredTestCase extends ModuleTestCase {
* Assert that core required modules cannot be disabled. * Assert that core required modules cannot be disabled.
*/ */
function testDisableRequired() { function testDisableRequired() {
$required_modules = drupal_required_modules(); $module_info = system_get_info('module');
$this->drupalGet('admin/modules'); $this->drupalGet('admin/modules');
foreach ($required_modules as $module) { foreach ($module_info as $module => $info) {
// Check to make sure the checkbox for required module is not found. // Check to make sure the checkbox for each required module is disabled
$this->assertNoFieldByName('modules[Core][' . $module . '][enable]'); // 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);
}
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment