Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The package manager correctly prohibits users from disabling modules that are required. However, this feature can be made more user-friendly by showing the reason why the module is required.
If you look at the source of field_system_info_alter, for instance, you can see that that module writes the reason why the module is required to the info array.
if ($non_deleted) {
if (module_exists('field_ui')) {
$explanation = t('Field type(s) in use - see !link', array('!link' => l(t('Field list'), 'admin/reports/fields')));
}
else {
$explanation = t('Fields type(s) in use');
}
}
else {
$explanation = t('Fields pending deletion');
}
$info['explanation'] = $explanation;
If I'm not mistaken, this was added in Drupal 7.8.
Drush should display this value to the user. Currently, it just displays:
video is a required module and can't be disabled.
Comment | File | Size | Author |
---|---|---|---|
#1 | drush-explanation-disable-required-modules-1467800-1.patch | 1.33 KB | Jorrit |
Comments
Comment #1
Jorrit CreditAttribution: Jorrit commentedAttached a patch that changes the output to:
Comment #2
jonhattanCommitted, thanks.