You are here

protected function ThemeInitialization::resolveStyleSheetPlaceholders in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Theme/ThemeInitialization.php \Drupal\Core\Theme\ThemeInitialization::resolveStyleSheetPlaceholders()

Gets CSS file where tokens have been resolved.

@todo Remove in Drupal 9.0.x.

Parameters

string $css_file: CSS file which may contain tokens.

Return value

string CSS file where placeholders are replaced.

1 call to ThemeInitialization::resolveStyleSheetPlaceholders()
ThemeInitialization::prepareStylesheetsRemove in core/lib/Drupal/Core/Theme/ThemeInitialization.php
Prepares stylesheets-remove specified in the *.info.yml file.

File

core/lib/Drupal/Core/Theme/ThemeInitialization.php, line 286
Contains \Drupal\Core\Theme\ThemeInitialization.

Class

ThemeInitialization
Provides the theme initialization logic.

Namespace

Drupal\Core\Theme

Code

protected function resolveStyleSheetPlaceholders($css_file) {
  $token_candidate = explode('/', $css_file)[0];
  if (!preg_match('/@[A-z0-9_-]+/', $token_candidate)) {
    return $css_file;
  }
  $token = substr($token_candidate, 1);

  // Prime extensions.
  $extensions = $this
    ->getExtensions();
  if (isset($extensions[$token])) {
    return str_replace($token_candidate, $extensions[$token]
      ->getPath(), $css_file);
  }
}