/[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, Fri Sep 5 19:08:44 2008 UTC revision 1.1.4.1, Sat Sep 13 18:15:31 2008 UTC
# Line 5  This hook gets the module specific data Line 5  This hook gets the module specific data
5  for each module and inserts it into the system_modules form  for each module and inserts it into the system_modules form
6  which is displayed on the pages admin/build/modules and admin/build/modules/list  which is displayed on the pages admin/build/modules and admin/build/modules/list
7  ****/  ****/
8  function moduleinfo_form_alter($form, $form_state, $form_id){  /** 5.x? **/
9    function moduleinfo_form_alter($form_id, &$form){
10      $files = module_rebuild_cache();      $files = module_rebuild_cache();
11      if ($form_id=="system_modules"){      //print_r($files);
12        if ($form_id=="system_modules"){//echo "yesssform";
13          foreach($form["description"] as $module=>$description){          foreach($form["description"] as $module=>$description){
14              if ($files[$module]->status=="0")continue;              if ($files[$module]->status=="0")continue;
15    
# Line 24  function moduleinfo_form_alter($form, $f Line 26  function moduleinfo_form_alter($form, $f
26          }          }
27      }      }
28  }  }
29    /** 5.x **/
30  /****  /****
31  an implementation of hook_help  an implementation of hook_help
32  ****/  ****/
# Line 52  function moduleinfo_moduleinfo(){ Line 55  function moduleinfo_moduleinfo(){
55      return $info;      return $info;
56  }  }
57  ***/  ***/
58    /** 5.x **/
59  /*** collects all the information we can find about a module from various hooks ***/  /*** collects all the information we can find about a module from various hooks ***/
60  function moduleinfo_get_info($module){  function moduleinfo_get_info($module){
61      $output = '';      $output = '';
# Line 83  function moduleinfo_get_info($module){ Line 86  function moduleinfo_get_info($module){
86      return $output;      return $output;
87  }  }
88    
89    /** 5.x **/
90  /*** check for help ***/  /*** check for help ***/
91  function moduleinfo_get_help($module){  function moduleinfo_get_help($module){
92      if (module_hook($module,"help")){      if (module_hook($module,"help")){
# Line 92  function moduleinfo_get_help($module){ Line 96  function moduleinfo_get_help($module){
96      }      }
97      return array();      return array();
98  }  }
99    /** 5.x **/
100  /*** check for pages, both config and other ***/  /*** check for pages, both config and other ***/
101  /** todo -- display w/ submenu structure **/  /** todo -- display w/ submenu structure **/
102  function moduleinfo_get_pages($module,$cached=TRUE){  function moduleinfo_get_pages($module,$cached=TRUE){
# Line 100  function moduleinfo_get_pages($module,$c Line 104  function moduleinfo_get_pages($module,$c
104      if (module_hook($module,"menu")){      if (module_hook($module,"menu")){
105          $menus = module_invoke($module, "menu", $cached);          $menus = module_invoke($module, "menu", $cached);
106          if ($menus){          if ($menus){
107              foreach ($menus as $path=>$menu){              foreach ($menus as $menu){
108                  if ($menu["type"]!=MENU_CALLBACK){  /** menu_callbacks wont appear in menus **/                  if ($menu["type"]!=MENU_CALLBACK){  /** menu_callbacks wont appear in menus **/
109                      $full = moduleinfo_get_breadcrumb($path);                      $full = moduleinfo_get_breadcrumb($menu["path"]);
110                      $txt="<li>".l(moduleinfo_get_menu_name($path),$path).'<sub>'.t(" ($full)")."</sub></li>\n";                      $txt="<li>".l(moduleinfo_get_menu_name($menu["path"]),$menu["path"]).'<sub>'.t(" ($full)")."</sub></li>\n";
111                      if (strpos($path,"admin/settings")!==FALSE)                      if (strpos($path,"admin/settings")!==FALSE)
112                          $pages["config"][] = '<li>'.l(moduleinfo_get_menu_name($path),$path).'</li>';                          $pages["config"][] = '<li>'.l(moduleinfo_get_menu_name($menu["path"]),$menu["path"]).'</li>';
113                      else                      else
114                          $pages["other"][] = $txt;                          $pages["other"][] = $txt;
115                  }                  }
# Line 114  function moduleinfo_get_pages($module,$c Line 118  function moduleinfo_get_pages($module,$c
118      }      }
119      return $pages;      return $pages;
120  }  }
121    /** 5.x **/
122  /*** check for block ***/  /*** check for block ***/
123  function moduleinfo_get_blocks($module){  function moduleinfo_get_blocks($module){
124      /*** check for blocks ***/      /*** check for blocks ***/
125      $blocks = array();      $blocks = array();
126      if (module_hook($module, "block")){      if (module_hook($module, "block")){
127              $mblocks = module_invoke($module,"block","list");          $mblocks = module_invoke($module,"block","list");
128              if ($mblocks){          if ($mblocks){
129                  foreach($mblocks as $i=>$block){              foreach($mblocks as $i=>$block){
130                      $blocks[] ="<li>".l($block["info"],"admin/build/block/configure/".$module."/".$i)."</li>\n";                  $blocks[] ="<li>".l($block["info"],"admin/build/block/configure/".$module."/".$i)."</li>\n";
                 }  
131              }              }
132          }          }
133        }
134      return $blocks;      return $blocks;
135  }  }
136    /** 5.x **/
137  /*** check for custom content-types ***/  /*** check for custom content-types ***/
138  function moduleinfo_get_content_types($module){  function moduleinfo_get_content_types($module){
139      $content_types = array();      $content_types = array();
140      if (module_hook($module, "node_info")){      if (module_hook($module, "node_info")){
141              $nodes = module_invoke($module,"node_info");          $nodes = module_invoke($module,"node_info");
142              if ($nodes){          if ($nodes){
143                  foreach ($nodes as $name=>$node){              foreach ($nodes as $name=>$node){
144                      $content_types[] = "<li>".l($node["name"],"admin/content/types/".$name).": ".$node["description"]."</li>\n";                  $content_types[] = "<li>".l($node["name"],"admin/content/types/".$name).": ".$node["description"]."</li>\n";
                 }  
145              }              }
146          }          }
147        }
148      return $content_types;      return $content_types;
149  }  }
150    /** 5.x **/
151  /*** grab a module name from the database ***/  /*** grab a module name from the database ***/
152  function moduleinfo_get_menu_name($path){  function moduleinfo_get_menu_name($path){
153      $result = db_query("SELECT link_title FROM {menu_links} WHERE link_path = '%s'",array($path));      $result = db_query("SELECT m.title FROM {menu} m WHERE m.path = '%s'",array($path));
154      $res = db_fetch_object($result)->link_title;      $res = db_fetch_object($result)->link_title;
155      if (!$res){      if (!$res){
156          $res = array_slice(explode("/",$path),-1);          $res = array_slice(explode("/",$path),-1);
# Line 154  function moduleinfo_get_menu_name($path) Line 158  function moduleinfo_get_menu_name($path)
158      }      }
159      return $res;      return $res;
160  }  }
161    /** 5.x **/
162  /*** generate a breadcrumb-style string from a menu path ***/  /*** generate a breadcrumb-style string from a menu path ***/
163  function moduleinfo_get_breadcrumb($path){  function moduleinfo_get_breadcrumb($path){
164      $parts = explode("/",$path);      $parts = explode("/",$path);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

  ViewVC Help
Powered by ViewVC 1.1.2