You are here

public static function Bootstrap::getTheme in Express 8

Retrieves a theme instance of \Drupal\bootstrap.

Parameters

string $name: The machine name of a theme. If omitted, the active theme will be used.

\Drupal\Core\Extension\ThemeHandlerInterface $theme_handler: The theme handler object.

Return value

\Drupal\bootstrap\Theme A theme object.

19 calls to Bootstrap::getTheme()
Bootstrap::alter in themes/contrib/bootstrap/src/Bootstrap.php
Manages theme alter hooks as classes and allows sub-themes to sub-class.
Bootstrap::cssClassFromString in themes/contrib/bootstrap/src/Bootstrap.php
Matches a Bootstrap class based on a string value.
Bootstrap::glyphiconFromString in themes/contrib/bootstrap/src/Bootstrap.php
Matches a Bootstrap Glyphicon based on a string value.
Bootstrap::initialize in themes/contrib/bootstrap/src/Bootstrap.php
Initializes the active theme.
Bootstrap::preprocess in themes/contrib/bootstrap/src/Bootstrap.php
Preprocess theme hook variables.

... See full list

File

themes/contrib/bootstrap/src/Bootstrap.php, line 459
Contains \Drupal\bootstrap\Bootstrap.

Class

Bootstrap
The primary class for the Drupal Bootstrap base theme.

Namespace

Drupal\bootstrap

Code

public static function getTheme($name = NULL, ThemeHandlerInterface $theme_handler = NULL) {

  // Immediately return if theme passed is already instantiated.
  if ($name instanceof Theme) {
    return $name;
  }
  static $themes = [];
  static $active_theme;
  if (!isset($active_theme)) {
    $active_theme = \Drupal::theme()
      ->getActiveTheme()
      ->getName();
  }
  if (!isset($name)) {
    $name = $active_theme;
  }
  if (!isset($theme_handler)) {
    $theme_handler = self::getThemeHandler();
  }
  if (!isset($themes[$name])) {
    $themes[$name] = new Theme($theme_handler
      ->getTheme($name), $theme_handler);
  }
  return $themes[$name];
}