Class humhub\modules\ui\icon\components\IconFactory

Inheritancehumhub\modules\ui\icon\components\IconFactory » yii\base\Component
Available since version1.4

IconFactory handles the registration and access of IconProviders.

Modules may register additional IconProviders or overwrite the default IconProvider by means of registerProvider() within the EVENT_AFTER_INIT event.

If an IconProvider does only a subset of all icon names the humhub\modules\ui\icon\components\IconProvider::render() function should return null. In this case the IconFactory will fall back to an $fallbackProvider.

By default the FontAwesomeIconProvider is set as default provider.

See also \humhub\modules\ui\icon\components\DevtoolsIconProvider.

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_INIT \yii\base\Event Triggered after init, can be used to overwrite the \humhub\modules\ui\icon\components\defaultProvider humhub\modules\ui\icon\components\IconFactory

Property Details

$fallbackProvider public static property

Method Details

getInstance() public static method

public static humhub\modules\ui\icon\components\IconFactory getInstance ( )
return humhub\modules\ui\icon\components\IconFactory

Singleton instance

throws \yii\base\InvalidConfigException
getNames() public method

Returns the supported icon names of the IconProvider

See also humhub\modules\ui\icon\components\IconProvider::getNames().

public string[] getNames ( $providerId null )
$providerId null
getProvider() public method

public humhub\modules\ui\icon\components\IconProvider getProvider ( $providerId null )
$providerId string|null

Icon provider id

init() public method

public void init ( )
registerProvider() public static method

Adds a provider to this factory, if $isDefault is set to true the current default IconProvider will be overwritten.

public static void registerProvider ( humhub\modules\ui\icon\components\IconProvider $instance, $isDefault false )
$instance humhub\modules\ui\icon\components\IconProvider
$isDefault
render() public method
public mixed render ( $icon, $options = [] )
$icon
$options array
renderList() public method
public mixed renderList ( $listDefinition, $providerId null )
$listDefinition
$providerId null

Event Details

EVENT_AFTER_INIT event of type \yii\base\Event

Triggered after init, can be used to overwrite the \humhub\modules\ui\icon\components\defaultProvider