Field::validate()
Description #
Validate current field.
Source #
File: lib/form/class-field.php
public function validate() {
if ( true === $this->validated ) {
return;
}
if ( ! empty( $this->validate_cb ) ) {
foreach ( (array) $this->validate_cb as $validate ) {
// Callback for validating field type.
$cb = 'validate_' . trim( $validate );
if ( method_exists( 'AnsPress\Form\Validate', $cb ) ) {
call_user_func_array( 'AnsPress\Form\Validate::' . $cb, array( $this ) );
}
/**
* Custom validation callback.
*
* @param string $field_name CUrrent field.
* @param object $field CUrrent field.
* @since 4.1.7
*/
apply_filters_ref_array( "ap_field_{$cb}", array( $this->field_name, $this ) );
}
$this->validated = true;
}
}
Expand full source code Collapse full source code View on GitHub: lib/form/class-field.php:591
Add your comment