field_validation_required_validator.inc in Field Validation 7.2
File
field_validation_extras/plugins/validator/field_validation_required_validator.inc
View source
<?php
$plugin = array(
'label' => t('Required field'),
'description' => t('This validator allow you set custom validation error messages on required fields.'),
'handler' => array(
'class' => 'field_validation_required_validator',
),
);
class field_validation_required_validator extends field_validation_validator {
public function validate() {
if (FALSE === $this->value || empty($this->value) && '0' != $this->value) {
$this
->set_error();
}
}
}