]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fixes tags html markup issues
authorIsmayil Khayredinov <ismayil.khayredinov@hypejunction.com>
Mon, 9 Jan 2012 16:29:14 +0000 (17:29 +0100)
committerIsmayil Khayredinov <ismayil.khayredinov@hypejunction.com>
Mon, 9 Jan 2012 16:29:14 +0000 (17:29 +0100)
views/default/output/tags.php

index 6dedfacc7bdfa76ced9600692de46adbf22ede8d..27b7a32a496d5ea9f9978b6078cf505d4cbf0fb7 100644 (file)
@@ -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,21 @@ 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']}";
+               unset($vars['list_class']);
+       }
+
+       $item_class = "item-tag";
+       if (isset($vars['item_class'])) {
+               $item_class = "$item_class {$vars['item_class']}";
+               unset($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 +64,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;
 }
+