Icon
extends AbstractHelper
in package
Icon view helper
Tags
Table of Contents
- $cache : StorageInterface
- Cache for icons
- $config : array<string|int, mixed>
- Icon config from theme.config.php
- $defaultSet : string
- Default icon set
- $defaultTemplate : string
- Default icon template
- $esc : EscapeHtmlAttr
- Escape helper
- $iconMap : array<string|int, mixed>
- Transforming map
- $rtl : bool
- Are we in right to left text mode?
- $styleAppended : bool
- Prevent extra work by only appending the stylesheet once
- __construct() : mixed
- Constructor
- __invoke() : string
- Returns inline HTML for icon
- cacheKey() : string
- Create a unique key for icon names and extra attributes
- compileAttrs() : string
- Reduce extra parameters to one attribute string.
- mapIcon() : array<string|int, mixed>
- Map icon to set. Add prefix, return with set and template.
Properties
$cache
Cache for icons
protected
StorageInterface
$cache
$config
Icon config from theme.config.php
protected
array<string|int, mixed>
$config
$defaultSet
Default icon set
protected
string
$defaultSet
$defaultTemplate
Default icon template
protected
string
$defaultTemplate
$esc
Escape helper
protected
EscapeHtmlAttr
$esc
$iconMap
Transforming map
protected
array<string|int, mixed>
$iconMap
$rtl
Are we in right to left text mode?
protected
bool
$rtl
$styleAppended
Prevent extra work by only appending the stylesheet once
protected
bool
$styleAppended
= false
Methods
__construct()
Constructor
public
__construct(array<string|int, mixed> $config, StorageInterface $cache, EscapeHtmlAttr $escAttr[, bool $rtl = false ]) : mixed
Parameters
- $config : array<string|int, mixed>
-
Icon configuration
- $cache : StorageInterface
-
Cache instance
- $escAttr : EscapeHtmlAttr
-
EscapeHtmlAttr view helper
- $rtl : bool = false
-
Are we in right to left text mode?
Return values
mixed —__invoke()
Returns inline HTML for icon
public
__invoke(string $name[, array<string|int, mixed>|string $attrs = [] ]) : string
Parameters
- $name : string
-
Which icon?
- $attrs : array<string|int, mixed>|string = []
-
Additional HTML attributes
Return values
string —cacheKey()
Create a unique key for icon names and extra attributes
protected
cacheKey(string $name[, array<string|int, mixed> $attrs = [] ]) : string
Parameters
- $name : string
-
Icon name or key from theme.config.php
- $attrs : array<string|int, mixed> = []
-
Additional HTML attributes for the HTML tag
Return values
string —compileAttrs()
Reduce extra parameters to one attribute string.
protected
compileAttrs(array<string|int, mixed> $attrs) : string
Broken out for easier customization.
Parameters
- $attrs : array<string|int, mixed>
-
Additional HTML attributes for the HTML tag
Return values
string —mapIcon()
Map icon to set. Add prefix, return with set and template.
protected
mapIcon(string $name[, array<string|int, mixed> $aliasTrail = [] ]) : array<string|int, mixed>
Broken out for easier customization.
Parameters
- $name : string
-
Icon name or key from theme.config.php
- $aliasTrail : array<string|int, mixed> = []
-
Safety mechanism to prevent circular aliases