3 namespace Drupal\Core\Theme;
5 use Drupal\Core\Extension\Extension;
8 * Defines an interface which contain theme initialization logic.
10 interface ThemeInitializationInterface {
13 * Initializes a given theme.
15 * This loads the active theme, for example include its engine file.
17 * @param string $theme_name
18 * The machine name of the theme.
20 * @return \Drupal\Core\Theme\ActiveTheme
21 * An active theme object instance for the given theme.
23 public function initTheme($theme_name);
26 * Builds an active theme object.
28 * @param string $theme_name
29 * The machine name of the theme.
31 * @return \Drupal\Core\Theme\ActiveTheme
32 * An active theme object instance for the given theme.
34 * @throws \Drupal\Core\Theme\MissingThemeDependencyException
35 * Thrown when base theme for installed theme is not installed.
37 public function getActiveThemeByName($theme_name);
40 * Loads a theme, so it is ready to be used.
42 * Loading a theme includes loading and initializing the engine,
43 * each base theme and its engines.
45 * @param \Drupal\Core\Theme\ActiveTheme $active_theme
48 public function loadActiveTheme(ActiveTheme $active_theme);
51 * Builds up the active theme object from extensions.
53 * @param \Drupal\Core\Extension\Extension $theme
54 * The theme extension object.
55 * @param \Drupal\Core\Extension\Extension[] $base_themes
56 * An array of extension objects of base theme and its bases. It is ordered
57 * by 'next parent first', meaning the top level of the chain will be first.
59 * @return \Drupal\Core\Theme\ActiveTheme
60 * The active theme instance for the passed in $theme.
62 public function getActiveTheme(Extension $theme, array $base_themes = []);