You are here

function system_list in Drupal 8

Same name and namespace in other branches
  1. 7 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

array 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.

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal::service('theme_handler')->listInfo() instead.

See also

https://www.drupal.org/node/2709919

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

1 call to system_list()
SystemListTest::testSystemList in core/tests/Drupal/KernelTests/Core/Theme/SystemListTest.php
Tests installing a theme.

File

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

Code

function system_list($type) {
  @trigger_error('system_list() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal::service(\'theme_handler\')->listInfo() instead. See https://www.drupal.org/node/2709919', E_USER_DEPRECATED);
  $lists = [
    'theme' => \Drupal::service('theme_handler')
      ->listInfo(),
    'filepaths' => [],
  ];
  foreach ($lists['theme'] as $name => $theme) {
    $lists['filepaths'][] = [
      'type' => 'theme',
      'name' => $name,
      'filepath' => $theme
        ->getPathname(),
    ];
  }
  return $lists[$type];
}