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 Description
$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 Description
$string
string

String to process

Returns
string

public static reduceNameHierarchy (string $fieldName, int $level) : string

Reduces the field name hierarchy depth by $level levels.

country[city][0][street][0] turns into country[city][0] when reduced by 1 level; country[city][0][street][0] turns into country when reduced by 2 levels; etc.

Parameters
Property Description
$fieldName
string
$level
int
Returns
string
Copyright © 2024 Winter CMS