You are here

private function SystemListLoader::themesAddHierarchy in X Autoload 7.5

Parameters

array $themes:

1 call to SystemListLoader::themesAddHierarchy()
SystemListLoader::loadSystemLists in tests/src/VirtualDrupal/SystemListLoader.php

File

tests/src/VirtualDrupal/SystemListLoader.php, line 88

Class

SystemListLoader

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

private function themesAddHierarchy(array $themes) {
  foreach ($themes as $key => $theme) {
    if (!empty($theme->info['base theme'])) {

      // Make a list of the theme's base themes.
      $theme->base_themes = $this
        ->drupalFindBaseThemes($themes, $key);

      // Don't proceed if there was a problem with the root base theme.
      if (!current($theme->base_themes)) {
        continue;
      }

      // Determine the root base theme.
      $base_key = key($theme->base_themes);

      // Add to the list of sub-themes for each of the theme's base themes.
      foreach (array_keys($theme->base_themes) as $base_theme) {
        $themes[$base_theme]->sub_themes[$key] = $theme->info['name'];
      }

      // Add the base theme's theme engine info.
      $theme->info['engine'] = isset($themes[$base_key]->info['engine']) ? $themes[$base_key]->info['engine'] : 'theme';
    }
    else {

      // A plain theme is its own engine.
      $base_key = $key;
      if (!isset($theme->info['engine'])) {
        $theme->info['engine'] = 'theme';
      }
    }

    // Set the theme engine prefix.
    $theme->prefix = $theme->info['engine'] == 'theme' ? $base_key : $theme->info['engine'];
  }
}