Skip to content
Snippets Groups Projects
Commit 7b76e55f authored by soxofaan's avatar soxofaan
Browse files

initial commit of module

parents
No related branches found
No related tags found
No related merge requests found
; $Id$
name = "Module Paths"
description = "Provides a page and a block showing the paths of the enabled modules"
package = "Development"
core = 6.x
<?php
// $Id$
/**
* Implementation of hook_menu().
*/
function module_paths_menu() {
$items = array();
$items['module_paths'] = array(
'title' => 'Module paths',
'description' => 'View the paths of the enabled modules.',
'page callback' => 'module_paths_page',
'access arguments' => array('access devel information'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Implementation of hook_block()
*/
function module_paths_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks['module_paths'] = array('info' => t('Module paths'),);
return $blocks;
case 'view':
switch ($delta) {
case 'module_paths':
$block['subject'] = t('Module paths');
# build content
$items = array();
foreach (module_list() as $module) {
$parts = explode('/', drupal_get_path('module', $module));
if ($parts[0] != 'modules') {
$items[] = check_plain(array_pop($parts));
}
}
$items[] = l(t('More'), 'module_paths');
$block['content'] = implode(', ', $items);;
break;
}
return $block;
}
}
/**
* Page with list of enabled modules and their paths
*/
function module_paths_page() {
$header = array(t('Module'), t('Path'));
$rows = array();
foreach (module_list() as $module) {
$rows[] = array(check_plain($module), check_plain(drupal_get_path('module', $module)));
}
return theme_table($header, $rows);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment