Same name in other branches
  1. 5.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::translateCss()
  2. 6.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::translateCss()
  3. 8.x-3.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::translateCss()

Pass the CSS to the translator.

Paramètres

\Drupal\advagg\Asset\AssetOptimizationEvent $assetOptimizationEvent: The CSS optimization event.

Fichier

advagg_mod/src/EventSubscriber/InitSubscriber.php, line 166

Classe

InitSubscriber
Perform initialization tasks for advagg_mod.

Namespace

Drupal\advagg_mod\EventSubscriber

Code

public function translateCss(AssetOptimizationEvent $assetOptimizationEvent) {
    // Skip if not enabled.
    if (!$this->config
        ->get('css_translate')) {
        return;
    }
    $content = $assetOptimizationEvent->getContent();
    $content = $this->translator
        ->optimize($content, [], []);
    $assetOptimizationEvent->setContent($content);
}