Class humhub\modules\ui\view\components\Theme

Inheritancehumhub\modules\ui\view\components\Theme » yii\base\Theme
Subclasseshumhub\components\Theme
Available since version1.3

Theme represents a HumHub theme.

  • Overwrite views When humhub\modules\ui\view\components\View renders a view file, it will check the humhub\modules\ui\view\components\View::theme to see if there is a themed version of the view file exists. If so, the themed version will be rendered instead. See humhub\modules\ui\view\components\ThemeViews for more details.

  • Using less variables Using this theme class you can also access all LESS style variables of the current theme.

Examples:

$primaryColorCode = Yii::$app->view->theme->variable('primary');
$isFluid = (boolean) Yii::$app->view->theme->variable('isFluid');

See humhub\modules\ui\view\components\ThemeVariables for more details.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$parents humhub\modules\ui\view\components\Theme[] The parent themes humhub\modules\ui\view\components\Theme

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getActiveParents() Returns the parent themes of the currently active theme. humhub\modules\ui\view\components\Theme
initPathMap() Initialize the default view path map including all parent themes humhub\modules\ui\view\components\Theme

Property Details

$name public property

The name of the theme

public string $name null
$parents protected property

The parent themes

$publishResources public property

Indicates that resources should be published via assetManager

public boolean $publishResources false
$variables public property
$views public property

Method Details

activate() public method

Activate this theme

public void activate ( )
applyTo() public method

public void applyTo ( $path )
$path
getActiveParents() protected static method

Returns the parent themes of the currently active theme.

These parents are stored in the setting variable "themeParents" for faster lookup.

protected static humhub\modules\ui\view\components\Theme[]|null getActiveParents ( )
return humhub\modules\ui\view\components\Theme[]|null

The themes or null

getBaseUrl() public method

public void getBaseUrl ( )
getParents() public method

Returns the base/parent themes of this theme.

The parent is specified in the LESS Variable file as variable "baseTheme".

See also humhub\modules\ui\view\components\ThemeVariables.

public humhub\modules\ui\view\components\Theme[] getParents ( )
return humhub\modules\ui\view\components\Theme[]

The theme parents

init() public method

public void init ( )
initPathMap() protected method

Initialize the default view path map including all parent themes

protected void initPathMap ( )
isActive() public method

Checks whether the Theme is currently active.

public boolean isActive ( )
publishResources() public method

Publishs theme assets (e.g. images or css)

public string publishResources ( $force null )
$force boolean|null
return string

Url of published resources

register() public method

Registers theme css and resources to the view

public void register ( $includeParents true )
$includeParents boolean

Also register parent themes

variable() public method (available since version 1.2)

Returns the value of a given theme variable

public string variable ( $key, $default null )
$key string

The variable name

$default
return string

The variable value