Drupal 8  8.0.2
ThemeInitialization Class Reference
Inheritance diagram for ThemeInitialization:

Public Member Functions

 __construct ($root, ThemeHandlerInterface $theme_handler, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler)
 
 initTheme ($theme_name)
 
 getActiveThemeByName ($theme_name)
 
 loadActiveTheme (ActiveTheme $active_theme)
 
 getActiveTheme (Extension $theme, array $base_themes=[])
 

Protected Member Functions

 getExtensions ()
 
 resolveStyleSheetPlaceholders ($css_file)
 
 prepareStylesheetsRemove (Extension $theme, $base_themes)
 

Protected Attributes

 $themeHandler
 
 $cache
 
 $root
 
 $extensions
 

Detailed Description

Provides the theme initialization logic.

Constructor & Destructor Documentation

__construct (   $root,
ThemeHandlerInterface  $theme_handler,
CacheBackendInterface  $cache,
ModuleHandlerInterface  $module_handler 
)

Constructs a new ThemeInitialization object.

Parameters
string$rootThe app root.
\Drupal\Core\Extension\ThemeHandlerInterface$theme_handlerThe theme handler.
\Drupal\Core\Cache\CacheBackendInterface$cacheThe cache backend.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler to use to load modules.

References Drupal\cache(), Drupal\moduleHandler(), and Drupal\root().

Here is the call graph for this function:

Member Function Documentation

getActiveTheme ( Extension  $theme,
array  $base_themes = [] 
)

{Builds up the active theme object from extensions.

Parameters
\Drupal\Core\Extension\Extension$themeThe theme extension object.
\Drupal\Core\Extension\Extension[]$base_themes An array of extension objects of base theme and its bases. It is ordered by 'next parent first', meaning the top level of the chain will be first.
Returns
The active theme instance for the passed in $theme.
}

Implements ThemeInitializationInterface.

References Extension\getName(), Extension\getPath(), and ThemeInitialization\prepareStylesheetsRemove().

Referenced by ThemeInitialization\getActiveThemeByName().

Here is the call graph for this function:

Here is the caller graph for this function:

getActiveThemeByName (   $theme_name)

{Builds an active theme object.

Parameters
string$theme_nameThe machine name of the theme.
Returns
An active theme object instance for the given theme.
Exceptions
\Drupal\Core\Theme\MissingThemeDependencyExceptionThrown when base theme for installed theme is not installed.
}

Implements ThemeInitializationInterface.

References Drupal\cache(), ThemeInitialization\getActiveTheme(), and Drupal\root().

Referenced by ThemeInitialization\initTheme().

Here is the call graph for this function:

Here is the caller graph for this function:

getExtensions ( )
protected

Gets all extensions.

Returns
array

References Drupal\moduleHandler().

Referenced by ThemeInitialization\resolveStyleSheetPlaceholders().

Here is the call graph for this function:

Here is the caller graph for this function:

initTheme (   $theme_name)

{Initializes a given theme.This loads the active theme, for example include its engine file.

Parameters
string$theme_nameThe machine name of the theme.
Returns
An active theme object instance for the given theme.
}

Implements ThemeInitializationInterface.

References ThemeInitialization\getActiveThemeByName(), and ThemeInitialization\loadActiveTheme().

Here is the call graph for this function:

loadActiveTheme ( ActiveTheme  $active_theme)

{Loads a theme, so it is ready to be used.Loading a theme includes loading and initializing the engine, each base theme and its engines.

Parameters
\Drupal\Core\Theme\ActiveTheme$active_themeThe theme to load.
}

Implements ThemeInitializationInterface.

References ActiveTheme\getBaseThemes(), ActiveTheme\getEngine(), ActiveTheme\getExtension(), ActiveTheme\getOwner(), and Drupal\root().

Referenced by ThemeInitialization\initTheme().

Here is the call graph for this function:

Here is the caller graph for this function:

prepareStylesheetsRemove ( Extension  $theme,
  $base_themes 
)
protected

Prepares stylesheets-remove specified in the *.info.yml file.

Parameters
\Drupal\Core\Extension\Extension$themeThe theme extension object.
\Drupal\Core\Extension\Extension[]$base_themes An array of base themes.
Returns
string[] The list of stylesheets-remove specified in the *.info.yml file.
Todo:
Remove in Drupal 9.0.x.

References ThemeInitialization\resolveStyleSheetPlaceholders().

Referenced by ThemeInitialization\getActiveTheme().

Here is the call graph for this function:

Here is the caller graph for this function:

resolveStyleSheetPlaceholders (   $css_file)
protected

Gets CSS file where tokens have been resolved.

Parameters
string$css_fileCSS file which may contain tokens.
Returns
string CSS file where placeholders are replaced.
Todo:
Remove in Drupal 9.0.x.

References ThemeInitialization\getExtensions().

Referenced by ThemeInitialization\prepareStylesheetsRemove().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: