function entity_metadata_field_entity_property_info in Entity API 7
Implements hook_entity_property_info() on top of field module.
See also
File
- modules/
field.info.inc, line 14 - Provides info for fields.
Code
function entity_metadata_field_entity_property_info() {
$info = array();
// Loop over all field instances and add them as property.
foreach (field_info_fields() as $field_name => $field) {
$field += array(
'bundles' => array(),
);
if ($field_type = field_info_field_types($field['type'])) {
// Add in our default callback as the first one.
$field_type += array(
'property_callbacks' => array(),
);
array_unshift($field_type['property_callbacks'], 'entity_metadata_field_default_property_callback');
foreach ($field['bundles'] as $entity_type => $bundles) {
foreach ($bundles as $bundle) {
$instance = field_info_instance($entity_type, $field_name, $bundle);
if ($instance && empty($instance['deleted'])) {
foreach ($field_type['property_callbacks'] as $callback) {
if (function_exists($callback)) {
$callback($info, $entity_type, $field, $instance, $field_type);
}
else {
watchdog($entity_type, 'Missing property callback %callback.', array(
'%callback' => $callback,
), WATCHDOG_ERROR);
}
}
}
}
}
}
}
return $info;
}