October\Rain\Html\Helper

Source: ~/vendor/october/rain/src/Html/Helper.php

Methods that may be useful for processing HTML tasks

Public methods

public static array nameToArray($string $string)

Converts a HTML named array string to a PHP array. Empty values are removed. HTML: user[location][city] PHP: ['user', 'location', 'city']

Parameters
  • $string $string - String to process

public static string nameToId($string $string)

Converts a HTML array string to an identifier string. HTML: user[location][city] Result: user-location-city

Parameters
  • $string $string - String to process

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

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
  • string $fieldName
  • int $level