You are here

function _name_field_settings_validate in Name Field 6

1 call to _name_field_settings_validate()
name_field_settings in ./name.module
Implementation of hook_field_settings().

File

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

Code

function _name_field_settings_validate($field) {
  $settings = $field['field_settings'];
  $diff = array_diff_key(array_filter($settings['minimum_components']), array_filter($settings['components']));
  if (count($diff)) {
    $components = array_intersect_key(_name_translations(), $diff);
    form_set_error('field_settings][minimum_components][' . key($diff), t('The following components for %label are not selected for this name field: %components', array(
      '%label' => t('Minimum components'),
      '%components' => implode(', ', $components),
    )));
  }
}