protected function ThemeInitialization::prepareStylesheetsRemove

protected ThemeInitialization::prepareStylesheetsRemove(Extension $theme, $base_themes)

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.

File

core/lib/Drupal/Core/Theme/ThemeInitialization.php, line 309

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Theme!ThemeInitialization.php/function/ThemeInitialization::prepareStylesheetsRemove/8.1.x