Helper
Methods that may be useful for processing HTML tasks
class Winter\Storm\Html\Helper
Methods
public static nameToArray (string $string) : array
Converts a HTML named array string to a PHP array. Empty values are removed.
HTML: user[location][city] PHP: ['user', 'location', 'city']
Parameters
Property | Type | Description |
---|---|---|
$string | string |
string
String to process |
Returns
array
public static nameToId (string $string) : string
Converts a HTML array string to an identifier string.
HTML: user[location][city] Result: user-location-city
Parameters
Property | Type | Description |
---|---|---|
$string | string |
string
String to process |
Returns
string
public static reduceNameHierarchy (string $fieldName, integer $level) : string
Reduces the field name hierarchy depth by $level levels.
country[city][0][nestedform] turns into country[city][0] when reduced by 1 level; country[city][0][street][0] turns into country[city][0] when reduced by 1 level; country[city][0][nestedform] turns into country when reduced by 2 levels; country[city][0][street][0] turns into country when reduced by 2 levels; etc.
Parameters
Property | Type | Description |
---|---|---|
$fieldName | string |
string
|
$level | integer |
integer
|
Returns
string
Copyright © 2024 Winter CMS