ThemeHandler
class ThemeHandler implements ThemeHandlerInterface (View source)
Default theme handler using the config system to store installation statuses.
Properties
| protected array | $list | A list of all currently available themes. |
|
| protected ConfigFactoryInterface | $configFactory | The config factory to get the installed themes. |
|
| protected ThemeExtensionList | $themeList | An extension discovery instance. |
|
| protected string | $root | The app root. |
Methods
Constructs a new ThemeHandler.
Returns the default theme.
Refreshes the theme info data of currently installed themes.
Resets the internal state of the theme handler.
Scans and collects theme extension data and their engines.
Finds all the base themes for the specified theme.
Gets the human readable name of a given theme.
Returns an array of directories for all installed themes.
Determines whether a given theme is installed.
Returns a theme extension object from the currently active theme list.
Determines if a theme should be shown in the user interface.
Details
__construct(string $root, ConfigFactoryInterface $config_factory, ThemeExtensionList $theme_list)
Constructs a new ThemeHandler.
string
getDefault()
Returns the default theme.
Extension[]
listInfo()
Returns a list of currently installed themes.
addTheme(Extension $theme)
Adds a theme extension to the internal listing.
refreshInfo()
Refreshes the theme info data of currently installed themes.
Modules can alter theme info, so this is typically called after a module has been installed or uninstalled.
reset()
Resets the internal state of the theme handler.
Extension[]
rebuildThemeData()
Scans and collects theme extension data and their engines.
array
getBaseThemes(array $themes, string $theme)
Finds all the base themes for the specified theme.
Themes can inherit templates and function implementations from earlier themes.
string
getName(string $theme)
Gets the human readable name of a given theme.
array
getThemeDirectories()
Returns an array of directories for all installed themes.
Useful for tasks such as finding a file that exists in all theme directories.
bool
themeExists(string $theme)
Determines whether a given theme is installed.
Extension
getTheme(string $name)
Returns a theme extension object from the currently active theme list.
bool
hasUi(string $name)
Determines if a theme should be shown in the user interface.
To be shown in the UI the theme has to be installed. If the theme is hidden it will not be shown unless it is the default or admin theme.