Commit a9ed1099 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[gh-466] Entity API: Add patch that adds 'uri callback' to file entity

See http://drupal.org/node/1481372#comment-6529650
parent 2da3840c
......@@ -103,6 +103,10 @@ In this example the web root is /Library/WebServer/Documents and Apache runs as
- Fix so that drush pulls in the correct uri parameter. See http://drupal.org/node/1331106
* entity/entity.module, entity/modules/callbacks.inc
- Add 'uri callback' for file entities. See http://drupal.org/node/1481372#comment-6529650
* workbench_moderation.module
- Fix broken books in workbench_moderation_node_presave(). See http://drupal.org/node/1505060
......
......@@ -1384,6 +1384,9 @@ 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.
$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';
......
......@@ -946,3 +946,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();
}
/**
* Callback so that entity_uri() can generate a uri for file entities.
*/
function entity_metadata_uri_file($file) {
return array(
'path' => file_create_url($file->uri),
);
}
Supports Markdown
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