Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blambi/1900676 to your computer and use it in GitHub Desktop.
Save blambi/1900676 to your computer and use it in GitHub Desktop.
[Drupal 7] Add a machinename column to the modules listing
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 7ed232a..9a71679 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -797,6 +797,8 @@ function system_modules($form, $form_state = array()) {
foreach ($visible_files as $filename => $module) {
$extra = array();
$extra['enabled'] = (bool) $module->status;
+ $extra['machinename'] = $module->name;
+
if (!empty($module->info['required'] )) {
$extra['disabled'] = TRUE;
$extra['required_by'][] = $distribution_name . (!empty($module->info['explanation']) ? ' ('. $module->info['explanation'] .')' : '');
@@ -896,6 +898,7 @@ function system_modules($form, $form_state = array()) {
'#header' => array(
array('data' => t('Enabled'), 'class' => array('checkbox')),
t('Name'),
+ t('Machine name'),
t('Version'),
t('Description'),
array('data' => t('Operations'), 'colspan' => 3),
@@ -957,6 +960,9 @@ function _system_modules_build_row($info, $extra) {
$form['name'] = array(
'#markup' => $info['name'],
);
+ $form['machinename'] = array(
+ '#markup' => $extra['machinename'],
+ );
$form['description'] = array(
'#markup' => t($info['description']),
);
@@ -2589,6 +2595,7 @@ function theme_system_modules_fieldset($variables) {
$label .= ' for="' . $module['enable']['#id'] . '"';
}
$row[] = $label . '><strong>' . drupal_render($module['name']) . '</strong></label>';
+ $row[] = drupal_render($module['machinename']);
$row[] = drupal_render($module['version']);
// Add the description, along with any modules it requires.
$description = drupal_render($module['description']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment