You are here

function name_field_property_info_callback in Name Field 7

Additional callback to adapt the property info of name fields.

See also

entity_metadata_field_entity_property_info()

1 string reference to 'name_field_property_info_callback'
name_field_info in ./name.module
Implements hook_field_info().

File

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

Code

function name_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property =& $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
  $property['getter callback'] = 'entity_metadata_field_verbatim_get';
  $property['setter callback'] = 'entity_metadata_field_verbatim_set';

  // Auto-create the field item as soon as a property is set.
  $property['auto creation'] = 'name_field_item_create';
  $property['property info'] = name_field_item_property_info();
  foreach ($property['property info'] as $property_key => $property_info) {
    $property['property info'][$property_key]['required'] = !empty($field['settings']['minimun_components'][$property_key]);
    if (empty($field['settings']['components'][$property_key])) {
      unset($property['property info'][$property_key]);
    }
  }
  unset($property['query callback']);
}