function ThemeHandler::listInfo

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Extension/ThemeHandler.php \Drupal\Core\Extension\ThemeHandler::listInfo()
  2. 10 core/lib/Drupal/Core/Extension/ThemeHandler.php \Drupal\Core\Extension\ThemeHandler::listInfo()
  3. 9 core/lib/Drupal/Core/Extension/ThemeHandler.php \Drupal\Core\Extension\ThemeHandler::listInfo()
  4. 8.9.x core/lib/Drupal/Core/Extension/ThemeHandler.php \Drupal\Core\Extension\ThemeHandler::listInfo()

File

core/lib/Drupal/Core/Extension/ThemeHandler.php, line 67

Class

ThemeHandler
Default theme handler using the config system to store installation statuses.

Namespace

Drupal\Core\Extension

Code

public function listInfo() {
  if (!isset($this->list)) {
    $this->list = [];
    $installed_themes = array_keys($this->configFactory
      ->get('core.extension')
      ->get('theme'));
    if (!empty($installed_themes)) {
      $list = $this->themeList
        ->getList();
      foreach ($installed_themes as $theme) {
        // Do not add installed themes that cannot be found by the
        // extension.list.theme service. If a theme does go missing from the
        // file system any call to ::getTheme() will result in an exception
        // and an error being logged. Ignoring the problem here allows the
        // theme system to fix itself while updating.
        if (isset($list[$theme])) {
          $this->addTheme($list[$theme]);
        }
      }
    }
  }
  return $this->list;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.