You are here

function entity_metadata_field_image_callback in Entity API 7

Additional callback to adapt the property info for image fields. This callback gets invoked after entity_metadata_field_file_callback().

See also

entity_metadata_field_entity_property_info()

1 string reference to 'entity_metadata_field_image_callback'
entity_field_info_alter in includes/entity.property.inc
Implements hook_field_info_alter(). Defines default property types for core field types.

File

modules/field.info.inc, line 171
Provides info for fields.

Code

function entity_metadata_field_image_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property =& $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];

  // Update the property info with the info for image fields.
  $property['property info'] = entity_property_field_item_image_info();
  if (empty($instance['settings']['alt_field'])) {
    unset($property['property info']['alt']);
  }
  if (empty($instance['settings']['title_field'])) {
    unset($property['property info']['title']);
  }
}