You are here

function juicebox_element_validate_dimension in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 8.3 juicebox.module \juicebox_element_validate_dimension()
  2. 8.2 juicebox.module \juicebox_element_validate_dimension()

Form validation callback: validate width/height inputs.

1 string reference to 'juicebox_element_validate_dimension'
JuiceboxGalleryDrupal::confBaseForm in includes/JuiceboxGalleryDrupal.inc
Get common elements for Juicebox configuration forms.

File

./juicebox.module, line 424
Provides Drupal integration with the Juicebox library. This file contains the relevant Drupal hook implementations and callbacks.

Code

function juicebox_element_validate_dimension($element, &$form_state, $form) {
  if (!preg_match('/^[0-9]+?(%|px|em|in|cm|mm|ex|pt|pc)$/u', $element['#value'])) {
    form_error($element, t('Please ensure that you width and height values are entered in a standard numeric format (such as <strong>100%</strong> or <strong>300px</strong>).'));
  }
}