You are here

function _juicebox_element_validate_dimension in Juicebox HTML5 Responsive Image Galleries 7

Form validation callback: validate width/height inputs.

See also

_juicebox_common_form_elements()

1 string reference to '_juicebox_element_validate_dimension'
_juicebox_common_form_elements in ./juicebox.module
Helper to add common elements to Juicebox configuration forms.

File

./juicebox.module, line 817
Provides Drupal integration with the Juicebox library.

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