Interface humhub\modules\ui\icon\components\IconProvider

Implemented byhumhub\modules\ui\icon\components\FontAwesomeIconProvider
Available since version1.4

IconProviders are used to render an icon for a specific icon library.

The render() function of a IconProvider should ideally support all features of the humhub\modules\ui\icon\widgets\Icon widget and furthermore map all icon names available in humhub\modules\ui\icon\widgets\Icon::$names.

Method Details

getId() public abstract method

public abstract string getId ( )
return string

Unique factory id used in the lib option of icons

getNames() public abstract method

Return all supported icon names.

public abstract string[] getNames ( )
render() public abstract method

Use as follows:

IconFactory::render('task');

IconFactory::render('task', ['fixedWith' => true]);

IconFactory::render(['name' => 'task', 'fixedWith' => true]);

IconFactory::render(new Icon(['name' => 'task', 'fixedWith' => true]));

Note: If the provider does not support a specific icon name or feature it should return null.

public abstract mixed render ( $icon, $options = [] )
$icon

String|Icon|[]|null either an icon name, icon instance or icon array definition

$options
renderList() public abstract method

Renders a icon list:

<?= IconFactory::renderList([

['task' => 'My List Item 1', 'options' => []],
['tachometer' => 'My List Item 2', 'options' => []]

]); ?>

Note: If the provider does not support this feature, it should return null.

public abstract \humhub\modules\ui\icon\components\$ renderList ( $listDefinition )
$listDefinition