You are here

function unused_modules_show_modules in Unused Modules 6

Same name and namespace in other branches
  1. 7 unused_modules.module \unused_modules_show_modules()

Page callback.

Returns a table with modules with their (submodule & project) status.

1 string reference to 'unused_modules_show_modules'
unused_modules_menu in ./unused_modules.module
Implements hook_menu().

File

./unused_modules.module, line 122
This module lists modules and projects that are unused.

Code

function unused_modules_show_modules($op) {
  $modules = _unused_modules_get_modules_by_project();
  $header = array(
    'Project',
    'Module',
    'Module enabled',
    'Project has Enabled Modules',
    'Project Path',
  );
  $rows = array();
  foreach ($modules as $module) {
    if ($op == 'all') {
      $rows[$module->name] = array(
        $module->project,
        $module->name,
        $module->module_is_enabled ? t("Yes") : t("No"),
        $module->project_has_enabled_modules ? t("Yes") : t("No"),
        $module->project_path,
      );
    }
    elseif ($op == 'disabled') {
      if (!$module->project_has_enabled_modules) {
        $rows[$module->name] = array(
          $module->project,
          $module->name,
          $module->module_is_enabled ? t("Yes") : t("No"),
          $module->project_has_enabled_modules ? t("Yes") : t("No"),
          $module->project_path,
        );
      }
    }
  }
  if (!$rows) {
    return t("Hurray, no orphaned modules!");
  }

  // @drupal-6 backport: pass $header and $rows directly to theme_table.
  return theme('table', $header, $rows);
}