You are here

function _name_field_minimal_component_requirements in Name Field 6

Same name and namespace in other branches
  1. 7 name.module \_name_field_minimal_component_requirements()

Drupal does not validate checkboxes by default. With checkbox validate, the user may get two error messages.

1 string reference to '_name_field_minimal_component_requirements'
name_field_settings in ./name.module
Implementation of hook_field_settings().

File

./name.module, line 748
Defines an API for displaying and inputing names.

Code

function _name_field_minimal_component_requirements($element, &$form_state) {
  $required_field_set = array_flip(array(
    'given',
    'middle',
    'family',
  ));
  $value = array_intersect_key($required_field_set, array_filter((array) $element['#value']));
  if (empty($value)) {
    $required_fields = array_intersect_key(_name_translations(), $required_field_set);
    form_set_error(implode('][', $element['#parents']) . '][given', t('%label must have one of the following components: %components', array(
      '%label' => $element['#title'],
      '%components' => implode(', ', $required_fields),
    )));
  }
}