You are here

function commerce_cart_validate_refresh_frequency in Commerce Core 7

Form element validation handler for the cart refresh frequency value.

1 string reference to 'commerce_cart_validate_refresh_frequency'
commerce_cart_form_commerce_order_settings_form_alter in modules/cart/commerce_cart.module
Implements hook_form_FORM_ID_alter().

File

modules/cart/commerce_cart.module, line 421
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_validate_refresh_frequency($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0)) {
    form_error($element, t('%name must be 0 or a positive integer.', array(
      '%name' => $element['#title'],
    )));
  }
}