/[drupal]/contributions/modules/module_supports/module_supports.module
ViewVC logotype

Contents of /contributions/modules/module_supports/module_supports.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Nov 10 20:01:21 2008 UTC (12 months, 2 weeks ago) by davereid
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
Changes since 1.1: +2 -1 lines
File MIME type: text/x-php
- Removed testing supports[] info.
- Revised .info description
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 }

  ViewVC Help
Powered by ViewVC 1.1.2