diff options
-rw-r--r-- | views/default/css/elements/components.php | 9 | ||||
-rw-r--r-- | views/default/output/tags.php | 38 |
2 files changed, 34 insertions, 13 deletions
diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 77313fa1a..c71ef1de9 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -265,17 +265,16 @@ Tags *************************************** */ .elgg-tags { - display: inline; font-size: 85%; } -.elgg-tags li { - display: inline; +.elgg-tags > li { + float:left; margin-right: 5px; } -.elgg-tags li:after { +.elgg-tags li.elgg-tag:after { content: ","; } -.elgg-tags li:last-child:after { +.elgg-tags li.elgg-tag:last-child:after { content: ""; } .elgg-tagcloud { diff --git a/views/default/output/tags.php b/views/default/output/tags.php index 6dedfacc7..3082dd41e 100644 --- a/views/default/output/tags.php +++ b/views/default/output/tags.php @@ -7,6 +7,9 @@ * @uses $vars['type'] The entity type, optional * @uses $vars['subtype'] The entity subtype, optional * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags) + * @uses $vars['list_class'] Optional. Additional classes to be passed to <ul> element + * @uses $vars['item_class'] Optional. Additional classes to be passed to <li> elements + * @uses $vars['icon_class'] Optional. Additional classes to be passed to tags icon image */ if (isset($vars['entity'])) { @@ -38,9 +41,19 @@ if (!empty($vars['tags'])) { $vars['tags'] = array($vars['tags']); } - echo '<div>'; - echo elgg_view_icon('tag'); - echo '<ul class="elgg-tags">'; + $list_class = "elgg-tags"; + if (isset($vars['list_class'])) { + $list_class = "$list_class {$vars['list_class']}"; + } + + $item_class = "elgg-tag"; + if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; + } + + $icon_class = elgg_extract('icon_class', $vars); + $list_items = '<li>' . elgg_view_icon('tag', $icon_class) . '</li>'; + foreach($vars['tags'] as $tag) { if (!empty($vars['type'])) { $type = "&type={$vars['type']}"; @@ -49,11 +62,20 @@ if (!empty($vars['tags'])) { } $url = elgg_get_site_url() . 'search?q=' . urlencode($tag) . "&search_type=tags{$type}{$subtype}{$object}"; if (is_string($tag)) { - echo '<li>'; - echo elgg_view('output/url', array('href' => $url, 'text' => $tag, 'rel' => 'tag')); - echo '</li>'; + $list_items .= "<li class=\"$item_class\">"; + $list_items .= elgg_view('output/url', array('href' => $url, 'text' => $tag, 'rel' => 'tag')); + $list_items .= '</li>'; } } - echo '</ul>'; - echo '</div>'; + + $list = <<<___HTML + <div class="clearfix"> + <ul class="$list_class"> + $list_items + </ul> + </div> +___HTML; + + echo $list; } + |