diff --git a/entity.module b/entity.module index 3e872fa..3d559ac 100644 --- a/entity.module +++ b/entity.module @@ -903,14 +903,16 @@ function template_preprocess_entity(&$variables) { $info = entity_get_info($entity_type); $variables['title'] = check_plain(entity_label($entity_type, $entity)); + + $uri = entity_uri($entity_type, $entity); + $variables['url'] = $uri ? url($uri['path'], $uri['options']) : FALSE; + if (isset($variables['elements']['#page'])) { // If set by the caller, respect the page property. $variables['page'] = $variables['elements']['#page']; } else { // Else, try to automatically detect it. - $uri = entity_uri($entity_type, $entity); - $variables['url'] = $uri ? url($uri['path'], $uri['options']) : FALSE; $variables['page'] = $uri && $uri['path'] == $_GET['q']; }