You are here

function entity_metadata_field_imagefield_crop_callback in Imagefield Crop 7.3

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_imagefield_crop_callback'
imagefield_crop_field_info in ./imagefield_crop.module
Implements hook_field_info().

File

./imagefield_crop.module, line 38

Code

function entity_metadata_field_imagefield_crop_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($field['settings']['title_field'])) {
    unset($property['property info']['title']);
  }
  $property['property info']['croped_image'] = array(
    'type' => 'struct',
    'getter callback' => 'imagefield_crop_get_renderable',
    'label' => 'Renderable array of cropped image',
    'entity token' => FALSE,
  );
}