You are here

function name_field_load in Name Field 7

Implements hook_field_load().

File

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

Code

function name_field_load($entity_type, $entities, $field, $instances, $langcode, &$items) {
  foreach ($entities as $id => $entity) {

    // Use populated overrides if present.
    $instances[$id]['settings'] += array(
      'components' => array(),
    );
    $components = name_get_instance_components($field['settings']['components'], $instances[$id]['settings']['components']);
    foreach ($items[$id] as $delta => $item) {
      foreach (_name_translations() as $key => $title) {
        if (empty($components[$key])) {
          unset($items[$id][$delta][$key]);
        }
        else {
          $items[$id][$delta]['safe'][$key] = _name_value_sanitize($item, $key);
        }
      }
    }
  }
}