You are here

function photobox_gallery_custom_validate in PhotoboxPhotobox 7

Validate function for photobox_gallery_custom.

1 string reference to 'photobox_gallery_custom_validate'
photobox_field_formatter_settings_form in ./photobox.module
Implements hook_field_formatter_settings_form().

File

./photobox.module, line 171
Main file for the Photobox module.

Code

function photobox_gallery_custom_validate($element, &$form_state) {
  if (!empty($element['#value']) && !preg_match('!^[a-z0-9_-]+$!', $element['#value'])) {
    form_error($element, t('%name must only contain lowercase letters, numbers, hyphen and underscores.', array(
      '%name' => $element['#title'],
    )));
  }
}