class Themes

Constants

DEFAULT_THEME

The "default" theme adapts based on the latest recommendation from civicrm.org by switching to DEFAULT_THEME at runtime.

FALLBACK_THEME

Fallback is a pseudotheme which can be included in "search_order".

It locates files in the core/extension (non-theme) codebase.

PASSTHRU

Methods

__construct(CRM_Utils_Cache_Interface $cache = NULL)

Theme constructor.

string
getActiveThemeKey()

Determine the name of active theme.

array|NULL
get(string $themeKey)

Get the definition of the theme.

array
getAll()

Get a list of all known themes, including hidden base themes.

array
getAvailable()

Get a list of available themes, excluding hidden base themes.

array
resolveUrls(string $active, string $cssExt, string $cssFile)

Get the URL(s) for a themed CSS file.

array
buildAll()

Construct the list of available themes.

array
build(string $themeKey, array $theme)

Apply defaults for a given them.

string
cssId(string $cssExt, string $cssFile)

No description

Details

at line 74
__construct(CRM_Utils_Cache_Interface $cache = NULL)

Theme constructor.

Parameters

CRM_Utils_Cache_Interface $cache

at line 84
string getActiveThemeKey()

Determine the name of active theme.

Return Value

string Ex: "greenwich".

at line 114
array|NULL get(string $themeKey)

Get the definition of the theme.

Parameters

string $themeKey Ex: 'greenwich', 'shoreditch'.

Return Value

array|NULL

See also

CRM_Utils_Hook::themes

at line 127
array getAll()

Get a list of all known themes, including hidden base themes.

Return Value

array List of themes, keyed by name. Same format as CRM_Utils_Hook::themes(), but any default values are filled in.

See also

CRM_Utils_Hook::themes

at line 151
array getAvailable()

Get a list of available themes, excluding hidden base themes.

This is the same as getAll(), but abstract themes like "fallback" or "newyork_base" are omitted.

Return Value

array List of themes. Ex: ['greenwich' => 'Greenwich', 'shoreditch' => 'Shoreditch'].

See also

CRM_Utils_Hook::themes

at line 180
array resolveUrls(string $active, string $cssExt, string $cssFile)

Get the URL(s) for a themed CSS file.

This implements a prioritized search, in order: - Check for the specified theme. - If that doesn't exist, check for the default theme. - If that doesn't exist, use the 'none' theme.

Parameters

string $active Active theme key. Ex: 'greenwich'.
string $cssExt Ex: 'civicrm'.
string $cssFile Ex: 'css/bootstrap.css' or 'css/civicrm.css'.

Return Value

array List of URLs to display. Ex: array(string $url)

at line 212
protected array buildAll()

Construct the list of available themes.

Return Value

array List of themes, keyed by name.

See also

CRM_Utils_Hook::themes

at line 263
protected array build(string $themeKey, array $theme)

Apply defaults for a given them.

Parameters

string $themeKey The name of the theme. Ex: 'greenwich'.
array $theme The original theme definition of the theme (per CRM_Utils_Hook::themes).

Return Value

array The full theme definition of the theme (per CRM_Utils_Hook::themes).

See also

CRM_Utils_Hook::themes

at line 279
string cssId(string $cssExt, string $cssFile)

Parameters

string $cssExt
string $cssFile

Return Value

string