You are here

function _galleria_validate_opacity in Galleria 7

Validate a form element that should have a value between 0 and 1.

1 string reference to '_galleria_validate_opacity'
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 752
Administrative page callbacks for the galleria module.

Code

function _galleria_validate_opacity($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || $value < 0 || $value > 1)) {
    form_error($element, t('%name must be a value between 0 and 1.', array(
      '%name' => $element['#option_name'],
    )));
  }
}