diff --git a/video_embed_field.field.inc b/video_embed_field.field.inc index 3f2b1cc..bea363a 100755 --- a/video_embed_field.field.inc +++ b/video_embed_field.field.inc @@ -20,11 +20,31 @@ function video_embed_field_field_info() { ), 'default_widget' => 'video_embed_field_video', 'default_formatter' => 'video_embed_field', + 'property_callbacks' => array('video_embed_field_field_property_callback'), ), ); } /** + * Property callback for the Entity Metadata framework. + */ +function video_embed_field_field_property_callback(&$info, $entity_type, $field, $instance, $field_type) { + if (module_exists('entity')) { + // Set the property. + $field_type['property_type'] = $field['type']; + + // Then apply the default. + entity_metadata_field_default_property_callback($info, $entity_type, $field, $instance, $field_type); + + // Finally add in instance specific property info. + $name = $field['field_name']; + $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name]; + $property['getter callback'] = 'entity_metadata_field_verbatim_get'; + $property['setter callback'] = 'entity_metadata_field_verbatim_set'; + } +} + +/** * Implements hook_field_instance_settings_form(). */ function video_embed_field_field_instance_settings_form($field, $instance) {