The idea is that you want to see the tags in related items, where
items are related if they share at least one tag.
I was thinking that this would be a good plugin and was wondering if
any developers would be interested in making it.
The plugin could have two helper functions, which I've sketched below:
function related_item_tags_as_cloud($order = 'alpha', $tagsAreLinked =
true, $item=null, $limit=null)
{
if (!$item) {
$item = get_current_item();
}
$tags = get_tags(array('record'=>$item), null);
$relatedTags = get_related_tags($tags, $order, $limit)
$urlToLinkTo = ($tagsAreLinked) ? uri('items/browse/tag/') : null;
return tag_cloud($tags, $urlToLinkTo);
}
function get_related_tags($tags = array(), $order = 'alpha',
$limit=null)
{
$db = get_db();
$relatedTags = array();
$tagTable = $db->getTable('Tag');
$taggingsTable = $db->getTable('Taggings');
// you need to fill out the details of the following code
// $relatedTaggings = all the taggings that belong to an item that
has at least one tag in $tags
// get $relatedTags from $relatedTaggings
return $relatedTags;
}
I could figure out the details by myself, but I was wondering if
anyone else in the dev community would like to do that, and thereby
learn more about how to create a plugin.
We could call this plugin RelatedTagCloud
Any takers on this mini development challenge?