Description
Validate a dates fieldWe only check for is_numeric() so that we can support half dates ? 2013/07/23
Usage
oikd8_field_validation_date( $value, $field, $data );Parameters
- $value
- ( string ) required – the field value
- $field
- ( string ) required – the field name
- $data
- ( array ) required – array of data about the field
Returns
voidSource
File name: oik-dates/oik-dates.phpLines:
1 to 12 of 12
function oikd8_field_validation_date( $value, $field, $data ) { // bw_trace2(); if ( $value ) { $preg_match = preg_match( '!\d{4}-\d{2}-\d{2}!', $value ); //$numeric = is_numeric( $value ); if ( !$preg_match ) { $text = sprintf( __( "Invalid %s" ), $data['#title'] ); bw_issue_message( $field, "non_numeric", $text, "error" ); } } return( $value ); }
Called by
Calls
Call hooks
API Letters:
