You are here

function uc_dropdown_attributes_attribute_value_check in Dropdown Attributes 6

1 call to uc_dropdown_attributes_attribute_value_check()
uc_dropdown_attributes_validate in ./uc_dropdown_attributes.module
Handles the validation of required fields.

File

./uc_dropdown_attributes.module, line 286
Show/hide attributes based on the values of other attributes.

Code

function uc_dropdown_attributes_attribute_value_check($aid, $values) {
  if (is_array($values)) {
    if (count(array_filter($values, 'nonzero')) == 0) {
      $attribute = uc_attribute_load($aid);
      form_set_error('attributes][' . $aid, $attribute->label . ' ' . t('field is required'));
    }
  }
  else {
    if ($values == '') {
      $attribute = uc_attribute_load($aid);
      form_set_error('attributes][' . $aid, $attribute->label . ' ' . t('field is required'));
    }
  }
}