class property_validation_regex_validator in Field Validation 7.2
Hierarchy
Expanded class hierarchy of property_validation_regex_validator
1 string reference to 'property_validation_regex_validator'
- property_validation_regex_validator.inc in property_validation/
plugins/ validator/ property_validation_regex_validator.inc
File
- property_validation/
plugins/ validator/ property_validation_regex_validator.inc, line 16
View source
class property_validation_regex_validator extends property_validation_validator {
/**
* Validate field.
*/
public function validate() {
mb_regex_encoding('UTF-8');
$regex = $this->rule->settings['data'];
if ($this->value != '' && !mb_ereg("{$regex}", $this->value)) {
$this
->set_error();
}
}
/**
* Provide settings option.
*/
function settings_form(&$form, &$form_state) {
$default_settings = $this
->get_default_settings($form, $form_state);
// Print debug($default_settings);
$form['settings']['data'] = array(
'#title' => t('Regex code'),
'#description' => t("Specify regex code to validate the user input against."),
'#type' => 'textarea',
'#default_value' => isset($default_settings['data']) ? $default_settings['data'] : '',
);
parent::settings_form($form, $form_state);
}
}