protected function buildFormOptions($name, array $field, $data = null)
    {
        // Allow sub options structure (collection case)
        if (isset($field['options']['constraints'])) {
            $field['options']['options'] = $this->buildFormOptions('', $field['options']);
        }

        $constraints = array();
        foreach ($field['constraints'] as $constraint) {
            $constraints[] = $this->buildConstraint($constraint);
        }

        $field['options']['constraints'] = $constraints;

        if (null !== $data && isset($data[$name])) {
            $field['options']['data'] = $data[$name];
        }

        return $field['options'];
    }
protected function buildFormOptions($name, array $field, $data = null)
    {
        // Allow sub options structure (collection case)
        if (isset($field['options']['constraints'])) {
            $field['options']['options'] = $this->buildFormOptions('', $field['options']);
        }

        $constraints = array();
        foreach ($field['constraints'] as $constraint) {
            $constraints[] = $this->buildConstraint($constraint);
        }

        $field['options']['constraints'] = $constraints;

        if (null !== $data && isset($data[$name])) {
            $field['options']['data'] = $data[$name];
        }

        return $field['options'];
    }
protected function buildFormOptions ( $ name , array $ field , $ data = null ) { // Allow sub options structure (collection case) if ( isset ( $ field [ 'options' ] [ 'constraints' ] ) ) { $ field [ 'options' ] [ 'options' ] = $ this -> buildFormOptions ( '' , $ field [ 'options' ] ) ; } $ constraints = array ( ) ; foreach ( $ field [ 'constraints' ] as $ constraint ) { $ constraints [ ] = $ this -> buildConstraint ( $ constraint ) ; } $ field [ 'options' ] [ 'constraints' ] = $ constraints ; if ( null !== $ data && isset ( $ data [ $ name ] ) ) { $ field [ 'options' ] [ 'data' ] = $ data [ $ name ] ; } return $ field [ 'options' ] ; }
Build form options.

@param string     $name
@param array      $field
@param array|null $data

@return array
Build form options .