You are here

protected static function Module::directories in Plug 7

Gets all the module directories.

Parameters

bool $all: Include values for disabled modules.

Return value

array A list of module directories.

1 call to Module::directories()
Module::getDirectories in src/Util/Module.php
Generates the cached array of enabled module directories.

File

src/Util/Module.php, line 79
Contains Drupal\plug\Util\Module.

Class

Module

Namespace

Drupal\plug\Util

Code

protected static function directories($all = FALSE) {
  $directories = array();
  if ($all) {

    // We cannot use module_list to get the disabled modules. Query the system
    // table instead.
    $sql = "SELECT name FROM {system} WHERE type = :type";
    $modules = db_query($sql, array(
      ':type' => 'module',
    ))
      ->fetchCol();
    $modules = drupal_map_assoc($modules);
  }
  else {
    $modules = module_list();
  }
  foreach ($modules as $module) {
    $directories[$module] = drupal_get_path('module', $module);
  }
  return $directories;
}