W3cubDocs

/Drupal 8

public function ThemeHandler::refreshInfo

public ThemeHandler::refreshInfo()

Refreshes the theme info data of currently installed themes.

Modules can alter theme info, so this is typically called after a module has been installed or uninstalled.

Overrides ThemeHandlerInterface::refreshInfo

File

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

Class

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

Namespace

Drupal\Core\Extension

Code

public function refreshInfo() {
  $this->reset();
  $extension_config = $this->configFactory->get('core.extension');
  $installed = $extension_config->get('theme');

  // @todo Avoid re-scanning all themes by retaining the original (unaltered)
  //   theme info somewhere.
  $list = $this->rebuildThemeData();
  foreach ($list as $name => $theme) {
    if (isset($installed[$name])) {
      $this->addTheme($theme);
    }
  }
  $this->state->set('system.theme.data', $this->list);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ThemeHandler.php/function/ThemeHandler::refreshInfo/8.1.x