ScssCompilerPluginBase.php in SCSS/Less Compiler 8
File
src/ScssCompilerPluginBase.php
View source
<?php
namespace Drupal\scss_compiler;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Messenger\MessengerTrait;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Component\Plugin\PluginBase;
abstract class ScssCompilerPluginBase extends PluginBase implements ScssCompilerPluginInterface, ContainerFactoryPluginInterface {
use StringTranslationTrait;
use MessengerTrait;
protected $scssCompiler;
protected $request;
protected $fileSystem;
protected $moduleHandler;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ScssCompilerInterface $scss_compiler, RequestStack $request_stack, FileSystemInterface $file_system, ModuleHandlerInterface $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->scssCompiler = $scss_compiler;
$this->request = $request_stack
->getCurrentRequest();
$this->fileSystem = $file_system;
$this->moduleHandler = $module_handler;
$this
->init();
}
public function init() {
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('scss_compiler'), $container
->get('request_stack'), $container
->get('file_system'), $container
->get('module_handler'));
}
}