function ThemeInitialization::resolveStyleSheetPlaceholders

Same name in other branches
  1. 9 core/lib/Drupal/Core/Theme/ThemeInitialization.php \Drupal\Core\Theme\ThemeInitialization::resolveStyleSheetPlaceholders()
  2. 10 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 297

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.