diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-22 10:55:51 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-22 10:55:51 +0000 |
commit | 8a45f27fca39f0356987c011c80e07c0f0413d6a (patch) | |
tree | 14a06cf61f30e584c1e08dfcfc346b789d82da01 /views/default/page | |
parent | a56299d152912d2617ffe4f7f59fce7f3d925e88 (diff) | |
download | elgg-8a45f27fca39f0356987c011c80e07c0f0413d6a.tar.gz elgg-8a45f27fca39f0356987c011c80e07c0f0413d6a.tar.bz2 |
Refs #2091 added a tagcloud block that accepts subtype
git-svn-id: http://code.elgg.org/elgg/trunk@8814 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/page')
-rw-r--r-- | views/default/page/elements/tagcloud_block.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/views/default/page/elements/tagcloud_block.php b/views/default/page/elements/tagcloud_block.php new file mode 100644 index 000000000..8b67c9e37 --- /dev/null +++ b/views/default/page/elements/tagcloud_block.php @@ -0,0 +1,57 @@ +<?php +/** + * Display content-based tags + * + * Generally used in a sidebar. Does not work with groups currently. + * + * @uses $vars['subtypes'] Object subtype string or array of subtypes + * @uses $vars['owner_guid'] The owner of the content being tagged + * @uses $vars['limit'] The maxinum number of tags to display + */ + +$owner_guid = elgg_extract('owner_guid', $vars, ELGG_ENTITIES_ANY_VALUE); +if (!$owner_guid) { + $owner_guid = ELGG_ENTITIES_ANY_VALUE; +} + +$owner_entity = get_entity($owner_guid); +if ($owner_entity && elgg_instanceof($owner_entity, 'group')) { + // not supporting groups so return + return true; +} + +$options = array( + 'type' => 'object', + 'subtype' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), + 'owner_guid' => $owner_guid, + 'threshold' => 0, + 'limit' => elgg_extract('limit', $vars, 50), + 'tag_name' => 'tags', +); + +$title = elgg_echo('tagcloud'); +if (is_array($options['subtype']) && count($options['subtype']) > 1) { + // we cannot provide links to tagged objects with multiple types + $tag_data = elgg_get_tags($options); + $cloud = elgg_view("output/tagcloud", array( + 'value' => $tag_data, + 'type' => $type, + )); +} else { + $cloud = elgg_view_tagcloud($options); +} +if (!$cloud) { + return true; +} + +// add a link to all site tags +$cloud .= '<p class="small">'; +$cloud .= elgg_view_icon('tag'); +$cloud .= elgg_view('output/url', array( + 'href' => 'tags', + 'text' => elgg_echo('tagcloud:allsitetags'), +)); +$cloud .= '</p>'; + + +echo elgg_view_module('aside', $title, $cloud); |