You are here

public function SystemListLoader::loadSystemLists in X Autoload 7.5

Return value

array[]

See also

system_list()

File

tests/src/VirtualDrupal/SystemListLoader.php, line 42

Class

SystemListLoader

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

public function loadSystemLists() {
  $lists = array(
    'module_enabled' => array(),
    'theme' => array(),
    'filepaths' => array(),
  );

  // The module name (rather than the filename) is used as the fallback
  // weighting in order to guarantee consistent behavior across different
  // Drupal installations, which might have modules installed in different
  // locations in the file system. The ordering here must also be
  // consistent with the one used in module_implements().
  foreach ($this->systemTable
    ->systemTableSortedObjects() as $record) {

    // Build a list of all enabled modules.
    if ($record->type == 'module') {
      if (1 != $record->status) {
        continue;
      }
      $lists['module_enabled'][$record->name] = $record;
    }
    elseif ($record->type == 'theme') {
      $lists['theme'][$record->name] = $record;
    }
    else {
      continue;
    }

    // Build a list of filenames so drupal_get_filename can use it.
    if ($record->status) {
      $lists['filepaths'][] = array(
        'type' => $record->type,
        'name' => $record->name,
        'filepath' => $record->filename,
      );
    }
  }
  $this
    ->themesAddHierarchy($lists['theme']);
  return $lists;
}