function InstallerKernel::getBaseThemes

Gets the base themes for a given theme.

Parameters

\Drupal\Core\Extension\Extension $profile: The profile being installed.

string $theme: The theme for installation.

Return value

string[] A list of base themes.

1 call to InstallerKernel::getBaseThemes()
InstallerKernel::getExtensions in core/lib/Drupal/Core/Installer/InstallerKernel.php
Get the core.extension config object.

File

core/lib/Drupal/Core/Installer/InstallerKernel.php, line 147

Class

InstallerKernel
Extend DrupalKernel to handle force some kernel behaviors.

Namespace

Drupal\Core\Installer

Code

private function getBaseThemes(Extension $profile, string $theme) : array {
  $base_themes = [];
  // Find all the available themes.
  $listing = new ExtensionDiscovery($this->root);
  $listing->setProfileDirectories([
    $profile->getName() => $profile->getPath(),
  ]);
  $themes = $listing->scan('theme');
  $info_parser = new InfoParser($this->root);
  $theme_info = $info_parser->parse($themes[$theme]->getPathname());
  $base_theme = $theme_info['base theme'] ?? FALSE;
  while ($base_theme) {
    $base_themes[] = $base_theme;
    $theme_info = $info_parser->parse($themes[$base_theme]->getPathname());
    $base_theme = $theme_info['base theme'] ?? FALSE;
  }
  return $base_themes;
}

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