src/Helpers/FormHelper.php
protected function constructFieldMeta(array $fields)
    {
        $result = array();
        foreach ($fields as $key => $field) {
            $name = isset($field['name']) ? $field['name'] : (isset($field['id']) ? $field['id'] : $key);
            $type = $field['type'];
            if ($type === 'checkbox') {
                foreach ($field['options'] as $checkboxKey => $option) {
                    $data = new \stdClass();
                    $data->name = $name;
                    $data->type = $type;
                    $data->collection = $key;
                    $result[$checkboxKey] = $data;
                }
            } else {
                $data = new \stdClass();
                $data->name = $name;
                $data->type = $type;
                $result[$key] = $data;
            }

            if (!empty($field['fields'])) {
                $result += $this->constructFieldMeta($field['fields']);
            }
        }
        return $result;
    }
protected function constructFieldMeta(array $fields)
    {
        $result = array();
        foreach ($fields as $key => $field) {
            $name = isset($field['name']) ? $field['name'] : (isset($field['id']) ? $field['id'] : $key);
            $type = $field['type'];
            if ($type === 'checkbox') {
                foreach ($field['options'] as $checkboxKey => $option) {
                    $data = new \stdClass();
                    $data->name = $name;
                    $data->type = $type;
                    $data->collection = $key;
                    $result[$checkboxKey] = $data;
                }
            } else {
                $data = new \stdClass();
                $data->name = $name;
                $data->type = $type;
                $result[$key] = $data;
            }

            if (!empty($field['fields'])) {
                $result += $this->constructFieldMeta($field['fields']);
            }
        }
        return $result;
    }
protected function constructFieldMeta ( array $ fields ) { $ result = array ( ) ; foreach ( $ fields as $ key => $ field ) { $ name = isset ( $ field [ 'name' ] ) ? $ field [ 'name' ] : ( isset ( $ field [ 'id' ] ) ? $ field [ 'id' ] : $ key ) ; $ type = $ field [ 'type' ] ; if ( $ type === 'checkbox' ) { foreach ( $ field [ 'options' ] as $ checkboxKey => $ option ) { $ data = new \ stdClass ( ) ; $ data -> name = $ name ; $ data -> type = $ type ; $ data -> collection = $ key ; $ result [ $ checkboxKey ] = $ data ; } } else { $ data = new \ stdClass ( ) ; $ data -> name = $ name ; $ data -> type = $ type ; $ result [ $ key ] = $ data ; } if ( ! empty ( $ field [ 'fields' ] ) ) { $ result += $ this -> constructFieldMeta ( $ field [ 'fields' ] ) ; } } return $ result ; }
Returns meta data about the given fields.

Internal method, do not call directly.

@param array[] $fields

@return array
Associative array of field names and their types.
Returns meta data about the given fields .