aboutsummaryrefslogtreecommitdiff
path: root/template.php
diff options
context:
space:
mode:
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);
+ }
+}