JsIcons
extends AbstractJsStrings
in package
JsIcons helper for passing icon HTML to Javascript
Tags
Table of Contents
- $iconHelper : Icon
- Icon helper
- $strings : array<string|int, mixed>
- Strings to convey (key = js key, value = value to map)
- $varName : string
- Variable name to store values
- __construct() : mixed
- Constructor
- addStrings() : void
- Add strings to the internal array.
- getJSON() : string
- Generate JSON from the internal strings
- getJSONFromArray() : string
- Generate JSON from an array
- getScript() : string
- Assign JSON to a variable.
- mapValue() : string
- Generate Icon from string
Properties
$iconHelper
Icon helper
protected
Icon
$iconHelper
$strings
Strings to convey (key = js key, value = value to map)
protected
array<string|int, mixed>
$strings
= []
$varName
Variable name to store values
protected
string
$varName
Methods
__construct()
Constructor
public
__construct(Icon $iconHelper[, string $varName = 'vufindIconString' ]) : mixed
Parameters
- $iconHelper : Icon
-
Icon helper
- $varName : string = 'vufindIconString'
-
Variable name to store icons
Return values
mixed —addStrings()
Add strings to the internal array.
public
addStrings(array<string|int, mixed> $new) : void
Parameters
- $new : array<string|int, mixed>
-
Strings to add
Return values
void —getJSON()
Generate JSON from the internal strings
public
getJSON() : string
Return values
string —getJSONFromArray()
Generate JSON from an array
public
getJSONFromArray(array<string|int, mixed> $strings) : string
Parameters
- $strings : array<string|int, mixed>
-
Strings to convey (key = js key, value = value to map)
Return values
string —getScript()
Assign JSON to a variable.
public
getScript() : string
Return values
string —mapValue()
Generate Icon from string
protected
mapValue(string $icon, string $key) : string
Parameters
- $icon : string
-
String to transform
- $key : string
-
JSON object key