trait FieldValidationTrait (View source)

Trait to add FieldValidator validation to a field, e.g. a DBField or FormField The field must implement FieldValidationInterface

Traits

Provides extensions to this object to integrate it with standard config API methods.

Config options

field_validators array

FieldValidators configuration for the field

Properties

Methods

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
validate()

Validate this field using FieldValidators

public
mixed
getValueForValidation()

Get the value of this field for use in validation via FieldValidators

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

ValidationResult validate()

Validate this field using FieldValidators

Return Value

ValidationResult

mixed getValueForValidation()

Get the value of this field for use in validation via FieldValidators

Intended to be overridden in subclasses when there is a need to provide something different from the value of the field itself, for instance DBComposite and CompositeField which need to provide a value that is a combination of the values of their children

Return Value

mixed