| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Shows in admin/build/modules how modules can be enhanced by other modules by
|
| 7 |
* using the supports[] information in modules' .info files.
|
| 8 |
*/
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Implementation of hook_form_FORM_ID_alter().
|
| 12 |
*/
|
| 13 |
function module_supports_form_system_modules_alter(&$form, $form_state) {
|
| 14 |
$files = module_rebuild_cache();
|
| 15 |
foreach ($files as $filename => $file) {
|
| 16 |
$supports = array();
|
| 17 |
if (isset($file->info['supports']) && is_array($file->info['supports'])) {
|
| 18 |
foreach ($file->info['supports'] as $supported_module) {
|
| 19 |
if (!isset($files[$supported_module]) || !$files[$supported_module]->status) {
|
| 20 |
if (isset($files[$supported_module])) {
|
| 21 |
$supports[] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $files[$supported_module]->info['name']));
|
| 22 |
}
|
| 23 |
else {
|
| 24 |
$supports[] = t('<a href="@link">@module</a> (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst($supported_module), '@link' => 'http://drupal.org/project/'. $supported_module));
|
| 25 |
$disabled[] = $filename;
|
| 26 |
$form['disabled_modules']['#value'][$filename] = FALSE;
|
| 27 |
}
|
| 28 |
}
|
| 29 |
else {
|
| 30 |
$supports[] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $files[$supported_module]->info['name']));
|
| 31 |
}
|
| 32 |
}
|
| 33 |
if (!empty($supports)) {
|
| 34 |
$form['description'][$file->name]['supports'] = array(
|
| 35 |
'#value' => t('Enhanced by: !supports', array('!supports' => implode(', ', $supports))),
|
| 36 |
'#prefix' => '<div class="admin-dependencies">',
|
| 37 |
'#suffix' => '</div>',
|
| 38 |
);
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
| 42 |
}
|