| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* Implementation of hook_menu(). |
| 6 |
|
*/ |
| 7 |
|
function moduleinfo_menu() { |
| 8 |
|
$items['admin/settings/moduleinfo'] = array( |
| 9 |
|
'title' => t('Moduleinfo'), |
| 10 |
|
'description' => t('Settings for Moduleinfo'), |
| 11 |
|
'page callback' => 'drupal_get_form', |
| 12 |
|
'page arguments' => array('moduleinfo_settings_form'), |
| 13 |
|
'access arguments' => array('moduleinfo settings'), |
| 14 |
|
); |
| 15 |
|
return $items; |
| 16 |
|
} |
| 17 |
|
|
| 18 |
|
/** |
| 19 |
|
* Implementation of hook_perm(). |
| 20 |
|
*/ |
| 21 |
|
function plugin_manager_perm() { |
| 22 |
|
return array('moduleinfo settings'); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
/**** |
/**** |
| 26 |
an implementation of hook_form_alter. |
an implementation of hook_form_alter. |
| 27 |
This hook gets the module specific data (from moduleinfo_get_info) |
This hook gets the module specific data (from moduleinfo_get_info) |
| 30 |
****/ |
****/ |
| 31 |
function moduleinfo_form_alter($form, $form_state, $form_id){ |
function moduleinfo_form_alter($form, $form_state, $form_id){ |
| 32 |
if ($form_id=="system_modules"){ |
if ($form_id=="system_modules"){ |
| 33 |
$files = module_rebuild_cache(); |
if ("admin/build/modules/info" == $_GET['q'] || variable_get('moduleinfo_shown',TRUE)){ |
| 34 |
|
$files = module_rebuild_cache(); |
| 35 |
foreach($form["description"] as $module=>$description){ |
foreach($form["description"] as $module=>$description){ |
| 36 |
if ($files[$module]->status=="0")continue; |
if ($files[$module]->status=="0")continue; |
| 37 |
|
|
| 46 |
); |
); |
| 47 |
$form["description"][$module]['#value'] .= theme('fieldset', $fieldset);; |
$form["description"][$module]['#value'] .= theme('fieldset', $fieldset);; |
| 48 |
} |
} |
| 49 |
|
} |
| 50 |
|
else { |
| 51 |
|
drupal_set_message(l(t("View info about your modules"),"admin/build/modules/info")); |
| 52 |
|
} |
| 53 |
} |
} |
| 54 |
} |
} |
| 55 |
/**** |
/**** |
| 196 |
} |
} |
| 197 |
return $breadcrumb; |
return $breadcrumb; |
| 198 |
} |
} |
| 199 |
|
|
| 200 |
|
function moduleinfo_settings_form() { |
| 201 |
|
|
| 202 |
|
$form['moduleinfo_shown'] = array( |
| 203 |
|
'#title' => t('Shown by Default'), |
| 204 |
|
'#type' => 'checkbox', |
| 205 |
|
'#description' => t('Show info on the main modules page or only on the sub-page (admin/build/modules/info)'), |
| 206 |
|
'#default_value' => variable_get('moduleinfo_shown', TRUE), |
| 207 |
|
); |
| 208 |
|
$form[] = array( |
| 209 |
|
'#type' => 'submit', |
| 210 |
|
'#value' => t('Save Settings'), |
| 211 |
|
); |
| 212 |
|
|
| 213 |
|
return $form; |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
function moduleinfo_settings_form_submit($form, &$form_state) { |
| 217 |
|
foreach ($form_state['values'] AS $name => $value) { |
| 218 |
|
if (!strcmp(drupal_substr($name, 0, drupal_strlen('moduleinfo_')), 'moduleinfo_')) { |
| 219 |
|
variable_set($name, $value); |
| 220 |
|
} |
| 221 |
|
} |
| 222 |
|
drupal_set_message(t("The settings have been saved.")); |
| 223 |
|
} |
| 224 |
|
|