aboutsummaryrefslogtreecommitdiff
path: root/template.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-11-08 19:58:21 -0200
committerSilvio Rhatto <rhatto@riseup.net>2011-11-08 19:58:21 -0200
commita47ffa1fa1d8b6b99c93aa4e5494c3a0e38e854e (patch)
treecc4d78f6e67e9b3388c6b7b593df0633f1fa769c /template.php
parent6cbe0a772fa20df6da0d5a20dc5f2fd75aa0f5de (diff)
downloadmuambeiro-a47ffa1fa1d8b6b99c93aa4e5494c3a0e38e854e.tar.gz
muambeiro-a47ffa1fa1d8b6b99c93aa4e5494c3a0e38e854e.tar.bz2
Link icons
Diffstat (limited to 'template.php')
-rw-r--r--template.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/template.php b/template.php
index 9da450e..5038ead 100644
--- a/template.php
+++ b/template.php
@@ -286,3 +286,32 @@ function muambeiro_ns() {
}
return $output;
}
+
+/**
+ * Overrides theme_link(). Add icons to links.
+ */
+function muambeiro_link($variables) {
+ $path = drupal_get_path('theme', 'muambeiro');
+ $file = $path .'/images/icons/' . $variables['path'] .'.png';
+
+ if (file_exists($file)) {
+ $icon = theme('image',
+ array(
+ 'path' => $file,
+ 'alt' => $variables['text'],
+ 'title' => $variables['text'],
+ )
+ );
+
+ $link = '<a href="' . check_plain(url($variables['path'], $variables['options']));
+ $link .= '"' . drupal_attributes($variables['options']['attributes']) . '>';
+ $link .= $icon;
+ $link .= ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text']));
+ $link .= '</a>';
+
+ return $link;
+ }
+ else {
+ return theme_link($variables);
+ }
+}