Commit 591aaa95 authored by fago's avatar fago

Issue #1481372 by ericras, skwashd | bluestarstudios: Fixed File entity should...

Issue #1481372 by ericras, skwashd | bluestarstudios: Fixed File entity should have an 'uri callback' defined.
parent 34e0bf3a
......@@ -1436,6 +1436,11 @@ function _entity_info_add_metadata(&$entity_info) {
$entity_info['node']['form callback'] = 'entity_metadata_form_node';
$entity_info['user']['form callback'] = 'entity_metadata_form_user';
// URI callbacks.
if (!isset($entity_info['file']['uri callback'])) {
$entity_info['file']['uri callback'] = 'entity_metadata_uri_file';
}
// View callbacks.
$entity_info['node']['view callback'] = 'entity_metadata_view_node';
$entity_info['user']['view callback'] = 'entity_metadata_view_single';
......
......@@ -975,3 +975,12 @@ function entity_metadata_field_query($entity_type, $property, $value, $limit) {
$result = $query->execute();
return !empty($result[$entity_type]) ? array_keys($result[$entity_type]) : array();
}
/**
* Implements entity_uri() callback for file entities.
*/
function entity_metadata_uri_file($file) {
return array(
'path' => file_create_url($file->uri),
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment