Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eric Rasmussen
UNL-CMS
Commits
a9ed1099
Commit
a9ed1099
authored
Sep 27, 2012
by
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
a9ed1099
...
...
@@ -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
...
...
sites/all/modules/entity/entity.module
View file @
a9ed1099
...
...
@@ -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'
;
...
...
sites/all/modules/entity/modules/callbacks.inc
View file @
a9ed1099
...
...
@@ -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
),
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment