You are here

private function EvaluationImplementation::drupalFindBaseThemes in Drupal 8 upgrade evaluation 6

Backport of the DBTNG drupal_find_base_themes() from Drupal 7.

1 call to EvaluationImplementation::drupalFindBaseThemes()
EvaluationImplementation::systemList in includes/EvaluationImplementation.php
Backport of the DBTNG system_list() from Drupal 7.

File

includes/EvaluationImplementation.php, line 1100

Class

EvaluationImplementation

Namespace

Upgrade_check

Code

private function drupalFindBaseThemes($themes, $key, $used_keys = array()) {
  $base_key = $themes[$key]->info['base theme'];

  // Does the base theme exist?
  if (!isset($themes[$base_key])) {
    return array(
      $base_key => NULL,
    );
  }
  $current_base_theme = array(
    $base_key => $themes[$base_key]->info['name'],
  );

  // Is the base theme itself a child of another theme?
  if (isset($themes[$base_key]->info['base theme'])) {

    // Do we already know the base themes of this theme?
    if (isset($themes[$base_key]->base_themes)) {
      return $themes[$base_key]->base_themes + $current_base_theme;
    }

    // Prevent loops.
    if (!empty($used_keys[$base_key])) {
      return array(
        $base_key => NULL,
      );
    }
    $used_keys[$base_key] = TRUE;
    return $this
      ->drupalFindBaseThemes($themes, $base_key, $used_keys) + $current_base_theme;
  }

  // If we get here, then this is our parent theme.
  return $current_base_theme;
}