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

Diff of /contributions/modules/moduleinfo/moduleinfo.module

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

revision 1.1.2.1, Wed May 27 15:38:39 2009 UTC revision 1.1.2.2, Wed May 27 16:10:12 2009 UTC
# Line 1  Line 1 
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)
# Line 7  which is displayed on the pages admin/bu Line 30  which is displayed on the pages admin/bu
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    
# Line 22  function moduleinfo_form_alter($form, $f Line 46  function moduleinfo_form_alter($form, $f
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  /****  /****
# Line 168  function moduleinfo_get_breadcrumb($path Line 196  function moduleinfo_get_breadcrumb($path
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    

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

  ViewVC Help
Powered by ViewVC 1.1.2