original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Set `errorKey` `elementName` `elementClass` for fields inside hasmany fields.
  
  @param Field $field
  
  @return Field
docstring_tokens: Set errorKey elementName elementClass for fields inside hasmany fields .