You are here

function _textimage_hex_validate in Textimage 7.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. 6.2 textimage_admin.inc \_textimage_hex_validate()

Auxiliar function to validate either the entered value is a valid hex color code or not.

1 string reference to '_textimage_hex_validate'
textimage_preset_edit in ./textimage.admin.inc
Todo.

File

./textimage.admin.inc, line 848
Textimage admin page callback

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'],
    )));
  }
}