You are here

function profile_module_manager_get_bundles in Profile Module Manager 7

Same name and namespace in other branches
  1. 7.2 profile_module_manager.module \profile_module_manager_get_bundles()

Retuns an array of bundles.

3 calls to profile_module_manager_get_bundles()
profile_module_manager_admin_settings in ./profile_module_manager.admin.inc
Page callback for admin/config/development/module-manager/settings
profile_module_manager_build_ideal in ./profile_module_manager.module
Retuns an array of modules that should be enabled
profile_module_manager_bundle_list in ./profile_module_manager.admin.inc
Callback for admin/settings/bundles/list

File

./profile_module_manager.module, line 135
Alters grouping in admin/modules using hook_system_info_alter

Code

function profile_module_manager_get_bundles($status = 'all') {
  if ($status == 'all') {
    $bundles = db_query("SELECT name, filename FROM {system} WHERE type = 'module' ORDER BY weight ASC, name ASC")
      ->fetchAllAssoc('name');
  }
  if ($status == 'enabled') {
    $bundles = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, name ASC")
      ->fetchAllAssoc('name');
  }

  // check for _bundle in the machine name, but also look for something in the .info
  // to avoid false positives from contrib?
  foreach ($bundles as $key => $bundle) {
    if (!strpos($bundle->name, '_bundle')) {
      unset($bundles[$key]);
    }
    if (!user_access('enable admin bundles') && strpos($bundle->name, '_admin_bundle')) {
      unset($bundles[$key]);
    }
  }
  return $bundles;
}