65747176f49625684e2703df332008971a86137b
[yaffs-website] / web / core / lib / Drupal / Core / Theme / ThemeInitializationInterface.php
1 <?php
2
3 namespace Drupal\Core\Theme;
4 use Drupal\Core\Extension\Extension;
5
6 /**
7  * Defines an interface which contain theme initialization logic.
8  */
9 interface ThemeInitializationInterface {
10
11   /**
12    * Initializes a given theme.
13    *
14    * This loads the active theme, for example include its engine file.
15    *
16    * @param string $theme_name
17    *   The machine name of the theme.
18    *
19    * @return \Drupal\Core\Theme\ActiveTheme
20    *   An active theme object instance for the given theme.
21    */
22   public function initTheme($theme_name);
23
24   /**
25    * Builds an active theme object.
26    *
27    * @param string $theme_name
28    *   The machine name of the theme.
29    *
30    * @return \Drupal\Core\Theme\ActiveTheme
31    *   An active theme object instance for the given theme.
32    *
33    * @throws \Drupal\Core\Theme\MissingThemeDependencyException
34    *   Thrown when base theme for installed theme is not installed.
35    */
36   public function getActiveThemeByName($theme_name);
37
38   /**
39    * Loads a theme, so it is ready to be used.
40    *
41    * Loading a theme includes loading and initializing the engine,
42    * each base theme and its engines.
43    *
44    * @param \Drupal\Core\Theme\ActiveTheme $active_theme
45    *   The theme to load.
46    */
47   public function loadActiveTheme(ActiveTheme $active_theme);
48
49   /**
50    * Builds up the active theme object from extensions.
51    *
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.
57    *
58    * @return \Drupal\Core\Theme\ActiveTheme
59    *   The active theme instance for the passed in $theme.
60    */
61   public function getActiveTheme(Extension $theme, array $base_themes = []);
62
63 }