You are here

public function ThemeInfoRebuildSubscriber::rebuildThemeInfo in Devel 8.3

Same name and namespace in other branches
  1. 8 src/EventSubscriber/ThemeInfoRebuildSubscriber.php \Drupal\devel\EventSubscriber\ThemeInfoRebuildSubscriber::rebuildThemeInfo()
  2. 8.2 src/EventSubscriber/ThemeInfoRebuildSubscriber.php \Drupal\devel\EventSubscriber\ThemeInfoRebuildSubscriber::rebuildThemeInfo()
  3. 4.x src/EventSubscriber/ThemeInfoRebuildSubscriber.php \Drupal\devel\EventSubscriber\ThemeInfoRebuildSubscriber::rebuildThemeInfo()

Forces the system to rebuild the theme registry.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The event to process.

File

src/EventSubscriber/ThemeInfoRebuildSubscriber.php, line 74

Class

ThemeInfoRebuildSubscriber
Subscriber for force the system to rebuild the theme registry.

Namespace

Drupal\devel\EventSubscriber

Code

public function rebuildThemeInfo(GetResponseEvent $event) {
  if ($this->config
    ->get('rebuild_theme')) {

    // Update the theme registry.
    drupal_theme_rebuild();

    // Refresh theme data.
    $this->themeHandler
      ->refreshInfo();

    // Resets the internal state of the theme handler and clear the 'system
    // list' cache; this allow to properly register, if needed, PSR-4
    // namespaces for theme extensions after refreshing the info data.
    $this->themeHandler
      ->reset();

    // Notify the user that the theme info are rebuilt on every request.
    $this
      ->triggerWarningIfNeeded($event
      ->getRequest());
  }
}