function addressfield_staticmap_mapsize_validate in Address Field Static Map 7
Map size validator.
Parameters
array $element: The element's render array.
array &$form_state: The form state.
array $form: The complete form render array.
1 string reference to 'addressfield_staticmap_mapsize_validate'
File
- ./
addressfield_staticmap.module, line 711 - Main file for the addressfield static map module.
Code
function addressfield_staticmap_mapsize_validate(array $element, array &$form_state, array $form) {
if (!$element['#value']) {
return;
}
$matches = array();
$valid = FALSE;
if (preg_match('/[Z0-9]*x[Z0-9]*/', $element['#value'], $matches)) {
if ($matches[0] == $element['#value']) {
$valid = TRUE;
}
}
if (!$valid) {
form_error($element, t('Invalid map size format. Please use format 123x456'));
}
}