3 namespace Drupal\Core\Theme;
4 use Drupal\Core\Extension\Extension;
7 * Defines an interface which contain theme initialization logic.
9 interface ThemeInitializationInterface {
12 * Initializes a given theme.
14 * This loads the active theme, for example include its engine file.
16 * @param string $theme_name
17 * The machine name of the theme.
19 * @return \Drupal\Core\Theme\ActiveTheme
20 * An active theme object instance for the given theme.
22 public function initTheme($theme_name);
25 * Builds an active theme object.
27 * @param string $theme_name
28 * The machine name of the theme.
30 * @return \Drupal\Core\Theme\ActiveTheme
31 * An active theme object instance for the given theme.
33 * @throws \Drupal\Core\Theme\MissingThemeDependencyException
34 * Thrown when base theme for installed theme is not installed.
36 public function getActiveThemeByName($theme_name);
39 * Loads a theme, so it is ready to be used.
41 * Loading a theme includes loading and initializing the engine,
42 * each base theme and its engines.
44 * @param \Drupal\Core\Theme\ActiveTheme $active_theme
47 public function loadActiveTheme(ActiveTheme $active_theme);
50 * Builds up the active theme object from extensions.
52 * @param \Drupal\Core\Extension\Extension $theme
53 * The theme extension object.
54 * @param \Drupal\Core\Extension\Extension[] $base_themes
55 * An array of extension objects of base theme and its bases. It is ordered
56 * by 'next parent first', meaning the top level of the chain will be first.
58 * @return \Drupal\Core\Theme\ActiveTheme
59 * The active theme instance for the passed in $theme.
61 public function getActiveTheme(Extension $theme, array $base_themes = []);