Class humhub\modules\ui\view\components\ThemeVariables

Inheritancehumhub\modules\ui\view\components\ThemeVariables » yii\base\Component
Available since version1.3

ThemeVariables provides access to LESS variables of a given humhub\modules\ui\view\components\Theme.

The variables will be stored in the application SettingManager for fast access.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
flushCache() Flushes stored variables from settings manager humhub\modules\ui\view\components\ThemeVariables
get() Returns a variable by given key humhub\modules\ui\view\components\ThemeVariables
init() humhub\modules\ui\view\components\ThemeVariables

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
ensureLoaded() Ensures that the settings manager was populated with the theme variables, if not the variables will be loaded into the settings manager. humhub\modules\ui\view\components\ThemeVariables
getSettingKey() Converts a theme variable key into a prefixed settings key. humhub\modules\ui\view\components\ThemeVariables
getSettingPrefix() humhub\modules\ui\view\components\ThemeVariables
storeVariables() Rewrites theme variables to settings (cache) humhub\modules\ui\view\components\ThemeVariables

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
SETTING_PREFIX 'theme.var.' humhub\modules\ui\view\components\ThemeVariables

Property Details

$module public property
$theme public property

Method Details

ensureLoaded() protected method

Ensures that the settings manager was populated with the theme variables, if not the variables will be loaded into the settings manager.

Do not run this method during 'init' to avoid storing variables of all available themes!

protected void ensureLoaded ( )
flushCache() public method

Flushes stored variables from settings manager

public void flushCache ( )
get() public method

Returns a variable by given key

public void get ( $key, $default null )
$key
$default
getSettingKey() protected method

Converts a theme variable key into a prefixed settings key.

The prefix is necessary to separate the theme variables

protected string getSettingKey ( $key )
$key
getSettingPrefix() protected method

protected string getSettingPrefix ( )
return string

A unique setting key prefix for this theme

init() public method

public void init ( )
storeVariables() protected method

Rewrites theme variables to settings (cache)

protected void storeVariables ( )