You are here

public function CompileSubscriber::onConfigChange in Theme Compiler 2.0.x

Compile all assets provided by this module on configuration changes.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration change event.

File

src/EventSubscriber/CompileSubscriber.php, line 129

Class

CompileSubscriber
An event subscriber used to trigger (re)compilation of this module's assets.

Namespace

Drupal\theme_compiler\EventSubscriber

Code

public function onConfigChange(ConfigCrudEvent $event) {
  $name = $event
    ->getConfig()
    ->getName();

  // Check if the changed config is a compilation dependency.
  if (in_array($name, $this
    ->getConfigDependencies(), TRUE)) {
    $this
      ->compile();
  }
}