From 75a0deb2722bde4fc7d60d02f186809fbc77320d Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 18 May 2011 00:07:38 -0500 Subject: Issue #1089174 by plach: Fixed Prepare view hooks do not receive the language parameter. --- includes/common.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 4168ec9a2..cb851d4b9 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); } } -- cgit v1.2.3 From 267b9c435c5d7266f4ce674b84d95bfe1f5a0920 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 18 May 2011 01:00:28 -0500 Subject: Issue #1096446 by plach: Fixed entity_label() is not passing along the () parameter. --- includes/common.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index cb851d4b9..5dadb4d16 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7595,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']}; -- cgit v1.2.3