You are here

function imagezoom_imagezoom_additional_validate in Image Zoom 7.2

imagezoom_additional settings custom validation.

1 string reference to 'imagezoom_imagezoom_additional_validate'
imagezoom_field_formatter_settings_form in ./imagezoom.module
Implements hook_field_formatter_settings_form().

File

./imagezoom.module, line 130
Provides an Image Zoom field formatter for Image fields.

Code

function imagezoom_imagezoom_additional_validate($element, &$form_state) {

  // Validate additional setting. Must be in specific format ex. option: value
  $settings_array = explode("\n", $element['#value']);
  foreach ($settings_array as $setting) {
    if (!empty($setting)) {
      if (!preg_match('/^[a-z][a-zA-Z0-9-_]*: ?[a-z0-9-_]*$/i', trim($setting))) {
        form_set_error('imagezoom_additional', t('Additional settings must be in the format "option: value".'));
      }
    }
  }
}