You are here

private function SystemList::systemList in X Autoload 7.5

Replicates system_list($type), with $type !== 'bootstrap'.

Parameters

string $type: Either 'module_enabled', 'theme' or 'filepaths'.

Return value

object[]|array[]

See also

system_list()

1 call to SystemList::systemList()
SystemList::systemListModuleEnabled in tests/src/VirtualDrupal/SystemList.php
Replicates system_list('module_enabled').

File

tests/src/VirtualDrupal/SystemList.php, line 62

Class

SystemList

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

private function systemList($type) {
  $lists =& $this->drupalStatic
    ->get('system_list');
  if (isset($lists['module_enabled'])) {
    return $lists[$type];
  }

  // Otherwise build the list for enabled modules and themes.
  if ($cached = $this->cache
    ->cacheGet('system_list', 'cache_bootstrap')) {
    $lists = $cached->data;
  }
  else {
    $lists = $this->systemListLoader
      ->loadSystemLists();
    $this->cache
      ->cacheSet('system_list', $lists, 'cache_bootstrap');
  }

  // To avoid a separate database lookup for the filepath, prime the
  // drupal_get_filename() static cache with all enabled modules and themes.
  foreach ($lists['filepaths'] as $item) {
    $this->drupalGetFilename
      ->drupalSetFilename($item['type'], $item['name'], $item['filepath']);
  }
  return $lists[$type];
}