summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-05-22 09:08:19 -0400
committerDries Buytaert <dries@buytaert.net>2011-05-22 09:08:19 -0400
commit5dbe8aa92b9e746962b43f9a24b10d7f9616d232 (patch)
tree3a99baca5a9f27bb3914ef9ee082eb4d2d6d84fc /includes/common.inc
parentc88f2e0188e48f4c4adfb101d70733a0b27d4685 (diff)
parent267b9c435c5d7266f4ce674b84d95bfe1f5a0920 (diff)
downloadbrdo-5dbe8aa92b9e746962b43f9a24b10d7f9616d232.tar.gz
brdo-5dbe8aa92b9e746962b43f9a24b10d7f9616d232.tar.bz2
Merge branch '7.x' of git.drupal.org:project/drupal into 7.x
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc13
1 files changed, 10 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 4168ec9a2..5dadb4d16 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7496,8 +7496,15 @@ function entity_get_controller($entity_type) {
* The type of entity, i.e. 'node', 'user'.
* @param $entities
* The entity objects which are being prepared for view, keyed by object ID.
+ * @param $langcode
+ * (optional) A language code to be used for rendering. Defaults to the global
+ * content language of the current request.
*/
-function entity_prepare_view($entity_type, $entities) {
+function entity_prepare_view($entity_type, $entities, $langcode = NULL) {
+ if (!isset($langcode)) {
+ $langcode = $GLOBALS['language_content']->language;
+ }
+
// To ensure hooks are only run once per entity, check for an
// entity_view_prepared flag and only process items without it.
// @todo: resolve this more generally for both entity and field level hooks.
@@ -7513,7 +7520,7 @@ function entity_prepare_view($entity_type, $entities) {
}
if (!empty($prepare)) {
- module_invoke_all('entity_prepare_view', $prepare, $entity_type);
+ module_invoke_all('entity_prepare_view', $prepare, $entity_type, $langcode);
}
}
@@ -7588,7 +7595,7 @@ function entity_label($entity_type, $entity) {
$label = FALSE;
$info = entity_get_info($entity_type);
if (isset($info['label callback']) && function_exists($info['label callback'])) {
- $label = $info['label callback']($entity);
+ $label = $info['label callback']($entity, $entity_type);
}
elseif (!empty($info['entity keys']['label']) && isset($entity->{$info['entity keys']['label']})) {
$label = $entity->{$info['entity keys']['label']};