src/FormView.php
protected function flattenCollection($field)
    {
        if (!isset($field['fields']) || !is_array($field['fields'])) {
            return [];
        }

        $fields = [];

        foreach ($field['fields'] as $field) {
            if (isset($field['fields']) && is_array($field['fields'])) {
                $fields += $this->flattenCollection($field);
            } else {
                $fields[$field['name']] = $field;
            }
        }

        return $fields;
    }
protected function flattenCollection($field)
    {
        if (!isset($field['fields']) || !is_array($field['fields'])) {
            return [];
        }

        $fields = [];

        foreach ($field['fields'] as $field) {
            if (isset($field['fields']) && is_array($field['fields'])) {
                $fields += $this->flattenCollection($field);
            } else {
                $fields[$field['name']] = $field;
            }
        }

        return $fields;
    }
protected function flattenCollection ( $ field ) { if ( ! isset ( $ field [ 'fields' ] ) || ! is_array ( $ field [ 'fields' ] ) ) { return [ ] ; } $ fields = [ ] ; foreach ( $ field [ 'fields' ] as $ field ) { if ( isset ( $ field [ 'fields' ] ) && is_array ( $ field [ 'fields' ] ) ) { $ fields += $ this -> flattenCollection ( $ field ) ; } else { $ fields [ $ field [ 'name' ] ] = $ field ; } } return $ fields ; }
Flatten the fields in a collection

@param $field
@return array
Flatten the fields in a collection