diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-30 11:45:12 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-30 11:45:12 +0000 |
commit | 942539d2865be193f93dd44c9c0ee44f25fbc70b (patch) | |
tree | b2fce9193e367e181261ab5a047f8311bca70a79 /engine/lib/metadata.php | |
parent | 85b94b0c3c9360bd8cf0aa8f9ba69a821d36f14b (diff) | |
download | elgg-942539d2865be193f93dd44c9c0ee44f25fbc70b.tar.gz elgg-942539d2865be193f93dd44c9c0ee44f25fbc70b.tar.bz2 |
Extender getURL() support (no overide as of yet)
git-svn-id: https://code.elgg.org/elgg/trunk@1591 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r-- | engine/lib/metadata.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index efa82db01..14e141ec4 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -108,6 +108,13 @@ { return delete_metadata($this->id); } + + /** + * Get a url for this item of metadata. + * + * @return string + */ + public function getURL() { return get_metadata_url($this->id); } // SYSTEM LOG INTERFACE //////////////////////////////////////////////////////////// @@ -726,6 +733,58 @@ return $valuearray;
+ } + + /** + * Get the URL for this item of metadata, by default this links to the export handler in the current view. + * + * @param int $id + */ + function get_metadata_url($id) + { + $id = (int)$id; + + global $CONFIG; + + if ($extender = get_metadata($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 false; }
/** Register the hook */ |