class OptGroup (View source)

Provides helpers for HTML option groups.

Methods

static array
flattenOptions(array $array)

Allows PHP array processing of multiple select options with the same value.

static 
doFlattenOptions(array $array, array $options)

Iterates over an array building a flat array with duplicate keys removed.

Details

static array flattenOptions(array $array)

Allows PHP array processing of multiple select options with the same value.

Used for form select elements which need to validate HTML option groups and multiple options which may return the same value. Associative PHP arrays cannot handle these structures, since they share a common key.

Parameters

array $array

The form options array to process.

Return Value

array

An array with all hierarchical elements flattened to a single array.

static protected doFlattenOptions(array $array, array $options)

Iterates over an array building a flat array with duplicate keys removed.

This function also handles cases where objects are passed as array values.

Parameters

array $array

The form options array to process.

array $options

The array of flattened options.