public function validate($value)
    {
        // if value required, then only valueTrue is allowed
        if ($this->required && $value !== $this->valueTrue) {
            throw new ValidationException([$this->name => 'Must be selected']);
        }
    }
public function validate($value)
    {
        // if value required, then only valueTrue is allowed
        if ($this->required && $value !== $this->valueTrue) {
            throw new ValidationException([$this->name => 'Must be selected']);
        }
    }
public function validate ( $ value ) { // if value required, then only valueTrue is allowed if ( $ this -> required && $ value !== $ this -> valueTrue ) { throw new ValidationException ( [ $ this -> name => 'Must be selected' ] ) ; } }
Validate if value is allowed for this field.

@param mixed $value
Validate if value is allowed for this field .