You are here

public function InitSubscriber::translateCss in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::translateCss()

Pass the CSS to the translator.

Parameters

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

File

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

Class

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);
}