diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-15 14:25:33 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-15 14:25:33 +0000 |
commit | e1a797c36b4a9ebf90f08d1a7cf81cacbdb0a4f0 (patch) | |
tree | b20267d977702926a0b501349d7655901fe1a68c /engine/lib | |
parent | c46cadcc8264e5ded6e335a337e0312fee42da3c (diff) | |
download | elgg-e1a797c36b4a9ebf90f08d1a7cf81cacbdb0a4f0.tar.gz elgg-e1a797c36b4a9ebf90f08d1a7cf81cacbdb0a4f0.tar.bz2 |
You can now override entity URLs with the setURL($string) method.
git-svn-id: https://code.elgg.org/elgg/trunk@1427 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/entities.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index ff997810c..720597a83 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -39,7 +39,12 @@ * Any field not appearing in this will be viewed as a */ protected $attributes; - +
+ /**
+ * If set, overrides the value of getURL()
+ */
+ protected $url_override;
+ /** * Temporary cache for metadata, permitting meta data access before a guid has obtained. */ @@ -437,7 +442,21 @@ * * @return string The URL */ - public function getURL() { return get_entity_url($this->getGUID()); } + public function getURL() {
+ if (!empty($this->url_override)) return $this->url_override;
+ return get_entity_url($this->getGUID());
+ }
+
+ /**
+ * Overrides the URL returned by getURL
+ *
+ * @param string $url The new item URL
+ * @return string The URL
+ */
+ public function setURL($url) {
+ $this->url_override = $url;
+ return $url;
+ } /** * Tests to see whether the object has been fully loaded. @@ -1450,7 +1469,7 @@ global $CONFIG; if ($entity = get_entity($entity_guid)) { - $url = ""; + $url = "";
if (isset($CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()])) { $function = $CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()]; |