diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 06:26:49 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 06:26:49 +0000 |
commit | 83c97345e8eada544d7da4586e2c77db469ed5b1 (patch) | |
tree | a1f3be8ca91873c1da221d108470bbac8dc1bb0d /includes/common.inc | |
parent | c78283e81bb60fd6c4574ad65d2b854dca524a98 (diff) | |
download | brdo-83c97345e8eada544d7da4586e2c77db469ed5b1.tar.gz brdo-83c97345e8eada544d7da4586e2c77db469ed5b1.tar.bz2 |
#525622 by Frando, yched, et al: Add entity hook callbacks so that 'as link' formatters have a generic way to build the url of an 'entity'.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 8d5f637d3..f8fb336c6 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6525,6 +6525,23 @@ function entity_prepare_view($entity_type, $entities) { } /** + * Returns the path to an entity. + * + * @param $entity_type + * The entity type; e.g. 'node' or 'user'. + * @param $entity + * The entity for which to generate a path. + * @return + * The path for the entity, or NULL if the entity has no page of its own. + */ +function entity_path($entity_type, $entity) { + $info = entity_get_info($entity_type); + if (isset($info['path callback']) && function_exists($info['path callback'])) { + return $info['path callback']($entity); + } +} + +/** * Performs one or more XML-RPC request(s). * * @param $url |