public function getAttributesForField(FormField $field)
    {
        // Obtain Attributes (from parent):
        
        $attributes = parent::getAttributesForField($field);
        
        // Handle Checkbox Set Fields:
        
        if ($field instanceof CheckboxSetField) {
            $attributes[$this->prefix('multiple')] = $field->getName();
        }
        
        // Merge Rule Attributes:
        
        if ($rules = $field->getValidatorRules()) {
            
            foreach ($rules as $rule) {
                
                // Check Rule Validity:
                
                if ($rule->isValid()) {
                    
                    // Merge Rule Attribute:
                    
                    $attributes[$this->prefix($rule->getAttribute())][] = $rule->getValue();
                    
                    // Merge Message Attribute:
                    
                    if ($rule->hasMessage()) {
                        $attributes[$this->attr('message', $rule->getAttribute())] = $rule->getMessage();
                    }
                    
                }
                
                // Merge Extra Rule Attributes:
                
                foreach ($rule->getAttributes() as $name => $value) {
                    $attributes[$this->attr($name)][] = $value;
                }
                
            }
            
        }
        
        // Answer Attributes:
        
        return $this->flatten($attributes);
    }
public function getAttributesForField(FormField $field)
    {
        // Obtain Attributes (from parent):
        
        $attributes = parent::getAttributesForField($field);
        
        // Handle Checkbox Set Fields:
        
        if ($field instanceof CheckboxSetField) {
            $attributes[$this->prefix('multiple')] = $field->getName();
        }
        
        // Merge Rule Attributes:
        
        if ($rules = $field->getValidatorRules()) {
            
            foreach ($rules as $rule) {
                
                // Check Rule Validity:
                
                if ($rule->isValid()) {
                    
                    // Merge Rule Attribute:
                    
                    $attributes[$this->prefix($rule->getAttribute())][] = $rule->getValue();
                    
                    // Merge Message Attribute:
                    
                    if ($rule->hasMessage()) {
                        $attributes[$this->attr('message', $rule->getAttribute())] = $rule->getMessage();
                    }
                    
                }
                
                // Merge Extra Rule Attributes:
                
                foreach ($rule->getAttributes() as $name => $value) {
                    $attributes[$this->attr($name)][] = $value;
                }
                
            }
            
        }
        
        // Answer Attributes:
        
        return $this->flatten($attributes);
    }
public function getAttributesForField ( FormField $ field ) { // Obtain Attributes (from parent): $ attributes = parent :: getAttributesForField ( $ field ) ; // Handle Checkbox Set Fields: if ( $ field instanceof CheckboxSetField ) { $ attributes [ $ this -> prefix ( 'multiple' ) ] = $ field -> getName ( ) ; } // Merge Rule Attributes: if ( $ rules = $ field -> getValidatorRules ( ) ) { foreach ( $ rules as $ rule ) { // Check Rule Validity: if ( $ rule -> isValid ( ) ) { // Merge Rule Attribute: $ attributes [ $ this -> prefix ( $ rule -> getAttribute ( ) ) ] [ ] = $ rule -> getValue ( ) ; // Merge Message Attribute: if ( $ rule -> hasMessage ( ) ) { $ attributes [ $ this -> attr ( 'message' , $ rule -> getAttribute ( ) ) ] = $ rule -> getMessage ( ) ; } } // Merge Extra Rule Attributes: foreach ( $ rule -> getAttributes ( ) as $ name => $ value ) { $ attributes [ $ this -> attr ( $ name ) ] [ ] = $ value ; } } } // Answer Attributes: return $ this -> flatten ( $ attributes ) ; }
Answers an array of the validator attributes for the given form field.

@param FormField $field

@return array
Answers an array of the validator attributes for the given form field .