From 82254eb5e19732856c7d5f493fc86145754021ed Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 30 Jul 2008 13:02:49 +0000 Subject: Introducing url handlers for extenders. git-svn-id: https://code.elgg.org/elgg/trunk@1598 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 50 +++++++++++----------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) (limited to 'engine/lib/annotations.php') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 255e8a9b0..5d2029591 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -683,47 +683,21 @@ { $id = (int)$id; - global $CONFIG; - if ($extender = get_annotation($id)) { - - $view = elgg_get_viewtype(); - - $guid = $extender->entity_guid; - $type = $extender->type; - - $url = ""; - - /*if (isset($CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()])) { - $function = $CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()]; - if (is_callable($function)) { - $url = $function($entity); - } - } - if (isset($CONFIG->entity_url_handler[$entity->getType()]['all'])) { - $function = $CONFIG->entity_url_handler[$entity->getType()]['all']; - if (is_callable($function)) { - $url = $function($entity); - } - } - if (isset($CONFIG->entity_url_handler['all']['all'])) { - $function = $CONFIG->entity_url_handler['all']['all']; - if (is_callable($function)) { - $url = $function($entity); - } - }*/ - - - if ($url == "") { - $nameid = $extender->id; - if ($type == 'volatile') - $nameid== $extender->name; - $url = $CONFIG->wwwroot . "$view/$guid/$type/$nameid/"; - } - return $url; - + return get_extender_url($extender); } return false; + } + + + /** + * Register an annotation url handler. + * + * @param string $function_name The function. + * @param string $extender_name The name, default 'all'. + */ + function register_annotation_url_handler($function_name, $extender_name = "all") { + return register_extender_url_handler($function_name, 'annotation', $extender_name); } /** Register the hook */ -- cgit v1.2.3