You are here

protected function BackendBase::getImportPath in SCSS Compiler 1.0.x

Attempt to retrieve the absolute import path for the compiler.

An import path may be defined as a compiler option, 'import_path', whose value must be absolute if not passed a theme compiler context; otherwise the path is theme-relative.

Parameters

\Drupal\compiler\CompilerContextInterface $context: A compiler context used to define a compilation.

Return value

string|null An absolute import path for the compiler on success; NULL otherwise.

File

src/BackendBase.php, line 111

Class

BackendBase
Provides a base compiler backend implementation.

Namespace

Drupal\compiler_scss

Code

protected function getImportPath(CompilerContextInterface $context) {
  $options = $context
    ->getOptions();
  if (array_key_exists('import_path', $options) && is_string($options['import_path']) && !empty($options['import_path'])) {
    $result = $this
      ->getAbsoluteFilePath($context, $options['import_path']);
  }
  return isset($result) ? $result : NULL;
}