You are here

function _textimage_hex_validate in Textimage 6.2

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \_textimage_hex_validate()
  2. 5 textimage.module \_textimage_hex_validate()
  3. 7.2 textimage.admin.inc \_textimage_hex_validate()

File

./textimage_admin.inc, line 846

Code

function _textimage_hex_validate($field, $field_name) {
  if (!empty($field['#value']) && !preg_match('/^#[0123456789ABCDEF]{1,6}$/i', $field['#value'])) {
    form_set_error($field_name, t('The value for %field must be in a hexidecimal format (i.e. #FFFFFF is white).', array(
      '%field' => $field['#title'],
    )));
  }
}