You are here

function _galleria_validate_number_auto in Galleria 7

Validate a form element that should have a number as value or the special value 'auto'.

1 string reference to '_galleria_validate_number_auto'
galleria_option_elements in includes/galleria.admin.inc
This function returns an array defining the form elements used to edit the different options.

File

includes/galleria.admin.inc, line 742
Administrative page callbacks for the galleria module.

Code

function _galleria_validate_number_auto($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && $value !== 'auto' && (!is_numeric($value) || $value < 0)) {
    form_error($element, t('%name must be a positive number or the special value \'auto\'.', array(
      '%name' => $element['#option_name'],
    )));
  }
}