public function ScssCompilerPluginManager::getInstanceById in SCSS/Less Compiler 8
Returns compiler instance by id.
Return value
\Drupal\scss_compiler\ScssCompilerPluginInterface Compiler instance.
File
- src/
ScssCompilerPluginManager.php, line 54
Class
- ScssCompilerPluginManager
- Provides an Scss Compiler plugin manager.
Namespace
Drupal\scss_compilerCode
public function getInstanceById($id) {
if (isset($this->compilers[$id])) {
return $this->compilers[$id];
}
try {
$definitions = $this
->getDefinitions();
$this->compilers[$id] = FALSE;
if (isset($definitions[$id])) {
$this->compilers[$id] = $this
->createInstance($id);
}
return $this->compilers[$id];
} catch (\Exception $e) {
\Drupal::messenger()
->addError($e
->getMessage());
}
}