You are here

function commerce_options_list_limit_validate in Commerce Core 7

Ensures an options list limit value is either empty or a positive integer.

2 string references to 'commerce_options_list_limit_validate'
commerce_customer_field_settings_form in modules/customer/commerce_customer.module
Implements hook_field_settings_form().
commerce_product_reference_field_settings_form in modules/product_reference/commerce_product_reference.module
Implements hook_field_settings_form().

File

./commerce.module, line 1277
Defines features and functions common to the Commerce modules.

Code

function commerce_options_list_limit_validate($element, &$form_state, $form) {
  if (!empty($element['#value']) && (!is_numeric($element['#value']) || $element['#value'] < 1)) {
    form_error($element, t('Use a positive number for the options list limit or else leave it blank for no limit.'));
  }
}