You are here

function system_list in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/module.inc \system_list()

Builds a list of installed themes.

Parameters

$type: The type of list to return:

  • theme: All installed themes.

Return value

An associative array of themes, keyed by name. For $type 'theme', the array values are objects representing the respective database row, with the 'info' property already unserialized.

See also

\Drupal\Core\Extension\ThemeHandler::listInfo()

6 calls to system_list()
system_get_info in core/modules/system/system.module
Returns an array of information about enabled modules or themes.
ThemeHandler::systemThemeList in core/lib/Drupal/Core/Extension/ThemeHandler.php
Wraps system_list().
ThemeInstallerTest::testEmpty in core/modules/system/src/Tests/Extension/ThemeInstallerTest.php
Verifies that no themes are installed by default.
ThemeInstallerTest::testInstall in core/modules/system/src/Tests/Extension/ThemeInstallerTest.php
Tests installing a theme.
ThemeInstallerTest::testThemeInfoAlter in core/modules/system/src/Tests/Extension/ThemeInstallerTest.php
Tests that theme info can be altered by a module.

... See full list

2 string references to 'system_list'
MemCacheStatisticsTestCase::testBootstrapStatistics in modules/memcache/tests/memcache.test
Checks for early bootstrap statistics.
system_list_reset in core/includes/module.inc
Resets all system_list() caches.

File

core/includes/module.inc, line 24
API for loading and interacting with Drupal modules.

Code

function system_list($type) {
  $lists =& drupal_static(__FUNCTION__);
  if ($cached = \Drupal::cache('bootstrap')
    ->get('system_list')) {
    $lists = $cached->data;
  }
  else {
    $lists = array(
      'theme' => array(),
      'filepaths' => array(),
    );

    // ThemeHandler maintains the 'system.theme.data' state record.
    $theme_data = \Drupal::state()
      ->get('system.theme.data', array());
    foreach ($theme_data as $name => $theme) {
      $lists['theme'][$name] = $theme;
      $lists['filepaths'][] = array(
        'type' => 'theme',
        'name' => $name,
        'filepath' => $theme
          ->getPathname(),
      );
    }
    \Drupal::cache('bootstrap')
      ->set('system_list', $lists);
  }

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