aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/annotations.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-08 20:59:08 -0500
committercash <cash.costello@gmail.com>2011-12-08 20:59:08 -0500
commitcafd3b84cead11f6e9bf4222f1e28ee3cc158a7a (patch)
tree093881d3c502c7e76d65cae488fbc05bfdaba6d6 /engine/lib/annotations.php
parent1ec7692c1639e8415cd9984d9ad040ec28bd9755 (diff)
downloadelgg-cafd3b84cead11f6e9bf4222f1e28ee3cc158a7a.tar.gz
elgg-cafd3b84cead11f6e9bf4222f1e28ee3cc158a7a.tar.bz2
Fixes #4025 added a url handler for comments
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r--engine/lib/annotations.php32
1 files changed, 27 insertions, 5 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index e40ab2e39..bfd40d1e8 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -529,6 +529,20 @@ function elgg_annotation_exists($entity_guid, $annotation_type, $owner_guid = NU
}
/**
+ * Return the URL for a comment
+ *
+ * @param ElggAnnotation $comment The comment object
+ * @return string
+ * @access private
+ */
+function elgg_comment_url_handler(ElggAnnotation $comment) {
+ $entity = $comment->getEntity();
+ if ($entity) {
+ return $entity->getURL() . '#item-annotation-' . $comment->id;
+ }
+}
+
+/**
* Register an annotation url handler.
*
* @param string $function_name The function.
@@ -540,11 +554,6 @@ function elgg_register_annotation_url_handler($extender_name = "all", $function_
return elgg_register_extender_url_handler('annotation', $extender_name, $function_name);
}
-/** Register the hook */
-elgg_register_plugin_hook_handler("export", "all", "export_annotation_plugin_hook", 2);
-
-elgg_register_plugin_hook_handler('unit_test', 'system', 'annotations_test');
-
/**
* Register annotation unit tests
* @access private
@@ -554,3 +563,16 @@ function annotations_test($hook, $type, $value, $params) {
$value[] = $CONFIG->path . 'engine/tests/api/annotations.php';
return $value;
}
+
+/**
+ * Initialize the annotation library
+ * @access private
+ */
+function elgg_annotations_init() {
+ elgg_register_annotation_url_handler('generic_comment', 'elgg_comment_url_handler');
+
+ elgg_register_plugin_hook_handler("export", "all", "export_annotation_plugin_hook", 2);
+ elgg_register_plugin_hook_handler('unit_test', 'system', 'annotations_test');
+}
+
+elgg_register_event_handler('init', 'system', 'elgg_annotations_init');