You are here

function fancybox_gallery_custom_validate in fancyBox 7.2

Custom element validator for the custom grouping value.

See also

fancybox_field_formatter_settings_form().

1 string reference to 'fancybox_gallery_custom_validate'
fancybox_field_formatter_settings_form in ./fancybox.module
Implements hook_field_formatter_settings_form().

File

./fancybox.module, line 400
Provides the fancyBox jQuery plugin, a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages, and an extensive settings page for configuring fancyBox settings and how fancyBox…

Code

function fancybox_gallery_custom_validate($element, &$form_state, $form) {
  if ($element['#value'] && !preg_match('/^[A-Za-z]+[A-Za-z0-9-_]*$/', $element['#value'])) {
    form_error($element, t('The custom grouping value must only contain letters, numbers, hyphens and underscores and it must begin with a letter.'));
  }
}