You are here

function _name_field_components_validate in Name Field 7

1 call to _name_field_components_validate()
_name_field_settings_form_validate in includes/name.content.inc
Implements the validation callback for the name_field_settings_form() form.

File

includes/name.content.inc, line 264
Provides additional Field functionality for the name module.

Code

function _name_field_components_validate($components, $minimum, $error_element) {
  $diff = array_diff_key(array_filter($minimum), array_filter($components));
  if (count($diff)) {
    $components = array_intersect_key(_name_translations(), $diff);
    form_set_error($error_element . '][' . key($diff), t('%components can not be selected for %label when they are not selected for %label2.', array(
      '%label' => t('Minimum components'),
      '%label2' => t('Components'),
      '%components' => implode(', ', $components),
    )));
  }
}