src/Form/NestedForm.php
protected function formatField(Field $field)
    {
        $column = $field->column();

        $elementName = $elementClass = $errorKey = [];

        $key = $this->key ?: 'new_'.static::DEFAULT_KEY_NAME;

        if (is_array($column)) {
            foreach ($column as $k => $name) {
                $errorKey[$k] = sprintf('%s.%s.%s', $this->relationName, $key, $name);
                $elementName[$k] = sprintf('%s[%s][%s]', $this->relationName, $key, $name);
                $elementClass[$k] = [$this->relationName, $name];
            }
        } else {
            $errorKey = sprintf('%s.%s.%s', $this->relationName, $key, $column);
            $elementName = sprintf('%s[%s][%s]', $this->relationName, $key, $column);
            $elementClass = [$this->relationName, $column];
        }

        return $field->setErrorKey($errorKey)
            ->setElementName($elementName)
            ->setElementClass($elementClass);
    }
protected function formatField(Field $field)
    {
        $column = $field->column();

        $elementName = $elementClass = $errorKey = [];

        $key = $this->key ?: 'new_'.static::DEFAULT_KEY_NAME;

        if (is_array($column)) {
            foreach ($column as $k => $name) {
                $errorKey[$k] = sprintf('%s.%s.%s', $this->relationName, $key, $name);
                $elementName[$k] = sprintf('%s[%s][%s]', $this->relationName, $key, $name);
                $elementClass[$k] = [$this->relationName, $name];
            }
        } else {
            $errorKey = sprintf('%s.%s.%s', $this->relationName, $key, $column);
            $elementName = sprintf('%s[%s][%s]', $this->relationName, $key, $column);
            $elementClass = [$this->relationName, $column];
        }

        return $field->setErrorKey($errorKey)
            ->setElementName($elementName)
            ->setElementClass($elementClass);
    }
protected function formatField ( Field $ field ) { $ column = $ field -> column ( ) ; $ elementName = $ elementClass = $ errorKey = [ ] ; $ key = $ this -> key ? : 'new_' . static :: DEFAULT_KEY_NAME ; if ( is_array ( $ column ) ) { foreach ( $ column as $ k => $ name ) { $ errorKey [ $ k ] = sprintf ( '%s.%s.%s' , $ this -> relationName , $ key , $ name ) ; $ elementName [ $ k ] = sprintf ( '%s[%s][%s]' , $ this -> relationName , $ key , $ name ) ; $ elementClass [ $ k ] = [ $ this -> relationName , $ name ] ; } } else { $ errorKey = sprintf ( '%s.%s.%s' , $ this -> relationName , $ key , $ column ) ; $ elementName = sprintf ( '%s[%s][%s]' , $ this -> relationName , $ key , $ column ) ; $ elementClass = [ $ this -> relationName , $ column ] ; } return $ field -> setErrorKey ( $ errorKey ) -> setElementName ( $ elementName ) -> setElementClass ( $ elementClass ) ; }
Set `errorKey` `elementName` `elementClass` for fields inside hasmany fields.

@param Field $field

@return Field
Set errorKey elementName elementClass for fields inside hasmany fields .