You are here

abstract class ScssCompilerPluginBase in SCSS/Less Compiler 8

Defines base abstract class for ScssCompiler plugins.

Hierarchy

Expanded class hierarchy of ScssCompilerPluginBase

3 files declare their use of ScssCompilerPluginBase
LessphpCompiler.php in src/Plugin/ScssCompiler/LessphpCompiler.php
LibsassCompiler.php in src/Plugin/ScssCompiler/LibsassCompiler.php
ScssphpCompiler.php in src/Plugin/ScssCompiler/ScssphpCompiler.php

File

src/ScssCompilerPluginBase.php, line 17

Namespace

Drupal\scss_compiler
View source
abstract class ScssCompilerPluginBase extends PluginBase implements ScssCompilerPluginInterface, ContainerFactoryPluginInterface {
  use StringTranslationTrait;
  use MessengerTrait;

  /**
   * The scss compiler service.
   *
   * @var \Drupal\scss_compiler\ScssCompilerInterface
   */
  protected $scssCompiler;

  /**
   * The current request.
   *
   * @var \Symfony\Component\HttpFoundation\Request
   */
  protected $request;

  /**
   * The file system service.
   *
   * @var \Drupal\Core\File\FileSystemInterface
   */
  protected $fileSystem;

  /**
   * The module handler.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * Constructs a SCSS Compiler base plugin.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin ID for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\scss_compiler\ScssCompilerInterface $scss_compiler
   *   The scss compiler service.
   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
   *   The request stack.
   * @param \Drupal\Core\File\FileSystemInterface $file_system
   *   The file system service.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   */
  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();
  }

  /**
   * Calls a code on plugin initialization.
   */
  public function init() {
  }

  /**
   * {@inheritdoc}
   */
  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'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
ScssCompilerPluginBase::$fileSystem protected property The file system service.
ScssCompilerPluginBase::$moduleHandler protected property The module handler.
ScssCompilerPluginBase::$request protected property The current request.
ScssCompilerPluginBase::$scssCompiler protected property The scss compiler service.
ScssCompilerPluginBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
ScssCompilerPluginBase::init public function Calls a code on plugin initialization. 3
ScssCompilerPluginBase::__construct public function Constructs a SCSS Compiler base plugin. Overrides PluginBase::__construct
ScssCompilerPluginInterface::checkLastModifyTime public function Checks if file was changed. 3
ScssCompilerPluginInterface::compile public function Compiles single source file. 3
ScssCompilerPluginInterface::getStatus public static function Returns status of compiler library. 3
ScssCompilerPluginInterface::getVersion public static function Returns compiler version. 3
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.