You are here

protected function ThemeInitialization::prepareStylesheetsRemove 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::prepareStylesheetsRemove()

Prepares stylesheets-remove specified in the *.info.yml file.

@todo Remove in Drupal 9.0.x.

Parameters

\Drupal\Core\Extension\Extension $theme: The theme extension object.

\Drupal\Core\Extension\Extension[] $base_themes: An array of base themes.

Return value

string[] The list of stylesheets-remove specified in the *.info.yml file.

1 call to ThemeInitialization::prepareStylesheetsRemove()
ThemeInitialization::getActiveTheme in core/lib/Drupal/Core/Theme/ThemeInitialization.php
Builds up the active theme object from extensions.

File

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

Class

ThemeInitialization
Provides the theme initialization logic.

Namespace

Drupal\Core\Theme

Code

protected function prepareStylesheetsRemove(Extension $theme, $base_themes) {

  // Prepare stylesheets from this theme as well as all ancestor themes.
  // We work it this way so that we can have child themes remove CSS files
  // easily from parent.
  $stylesheets_remove = array();

  // Grab stylesheets from base theme.
  foreach ($base_themes as $base) {
    $base_theme_path = $base
      ->getPath();
    if (!empty($base->info['stylesheets-remove'])) {
      foreach ($base->info['stylesheets-remove'] as $css_file) {
        $css_file = $this
          ->resolveStyleSheetPlaceholders($css_file);
        $stylesheets_remove[$css_file] = $css_file;
      }
    }
  }

  // Add stylesheets used by this theme.
  if (!empty($theme->info['stylesheets-remove'])) {
    foreach ($theme->info['stylesheets-remove'] as $css_file) {
      $css_file = $this
        ->resolveStyleSheetPlaceholders($css_file);
      $stylesheets_remove[$css_file] = $css_file;
    }
  }
  return $stylesheets_remove;
}