You are here

function ModuleList::moduleList in X Autoload 7.5

Replicates module_list($refresh, $bootstrap_refresh, $sort, NULL)

Parameters

bool $refresh:

bool $bootstrap_refresh:

bool $sort:

Return value

string[]

See also

module_list()

File

tests/src/VirtualDrupal/ModuleList.php, line 81

Class

ModuleList
Replicates module_list() with its static cache variables.

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

function moduleList($refresh = FALSE, $bootstrap_refresh = FALSE, $sort = FALSE) {
  if (empty($this->list) || $refresh) {
    $this->list = array();
    $sorted_list = NULL;
    if ($refresh) {

      // For the $refresh case, make sure that system_list() returns fresh
      // data.
      $this->drupalStatic
        ->resetKey('system_list');
    }
    if ($bootstrap_refresh) {
      $this->list = $this->systemList
        ->systemListBootstrap();
    }
    else {

      // Not using drupal_map_assoc() here as that requires common.inc.
      $this->list = array_keys($this->systemList
        ->systemListModuleEnabled());
      $this->list = !empty($this->list) ? array_combine($this->list, $this->list) : array();
    }
  }
  if ($sort) {
    return $this
      ->moduleListSorted();
  }
  if (count($this->list)) {

    # HackyLog::log($this->list);
  }
  return $this->list;
}