You are here

function rb_thinktwice_action_module_list in Rules Bonus Pack 7

Helper function to load a list of all available modules

1 string reference to 'rb_thinktwice_action_module_list'
rb_thinktwice_rules_action_info in ./rb_thinktwice.rules.inc
Implements hook_rules_action_info().

File

./rb_thinktwice.rules.inc, line 74
Rules actions that you should think twice about. Plus some helper functions.

Code

function rb_thinktwice_action_module_list() {

  // Get current list of modules.
  $files = system_rebuild_module_data();

  // Remove hidden modules from display list.
  $visible_files = $files;
  foreach ($visible_files as $filename => $file) {
    if (!empty($file->info['hidden'])) {
      unset($visible_files[$filename]);
    }
  }
  $modules = array();
  foreach ($visible_files as $module) {
    $modules[$module->name] = $module->info['name'];
  }
  return $modules;
}