You are here

function pm_recommended_modules_count in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 includes/pm.recommended.inc \pm_recommended_modules_count()

Determines the number of recommended modules, by status.

1 call to pm_recommended_modules_count()
pm_recommended_modules_problem in includes/pm.recommended.inc
Determines whether any recommended modules are missing or disabled.

File

includes/pm.recommended.inc, line 79
Recommended modules helper functions.

Code

function pm_recommended_modules_count() {
  $recommended_modules = module_invoke_all('pm_recommended_modules_info');
  $available_modules = pm_get_available_modules();
  $num_enabled = 0;
  $num_disabled = 0;
  $num_missing = 0;
  foreach ($recommended_modules as $shortname => $recommended_module) {
    if (isset($available_modules[$shortname])) {
      if ((bool) $available_modules[$shortname]['status']) {
        $num_enabled++;
      }
      else {
        $num_disabled++;
      }
    }
    else {
      $num_missing++;
    }
  }
  return array(
    'enabled' => $num_enabled,
    'disabled' => $num_disabled,
    'missing' => $num_missing,
  );
}