diff --git a/includes/common.inc b/includes/common.inc index f6171cf..51f3753 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7837,19 +7837,20 @@ function entity_uri($entity_type, $entity) { elseif (isset($info['uri callback'])) { $uri_callback = $info['uri callback']; } - else { - return NULL; - } - // Invoke the callback to get the URI. If there is no callback, return NULL. + // Invoke the callback to get the URI. if (isset($uri_callback) && function_exists($uri_callback)) { - $uri = $uri_callback($entity); - // Pass the entity data to url() so that alter functions do not need to - // lookup this entity again. - $uri['options']['entity_type'] = $entity_type; - $uri['options']['entity'] = $entity; - return $uri; + if ($uri = $uri_callback($entity)) { + // Pass the entity data to url() so that alter functions do not need to + // lookup this entity again. + $uri['options']['entity_type'] = $entity_type; + $uri['options']['entity'] = $entity; + return $uri; + } } + + // Return NULL if there is no callback, or the callback returned FALSE. + return NULL; } /**