diff options
-rw-r--r-- | images/icons/messages.png | bin | 0 -> 259 bytes | |||
-rw-r--r-- | template.php | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/images/icons/messages.png b/images/icons/messages.png Binary files differnew file mode 100644 index 0000000..30bbfb5 --- /dev/null +++ b/images/icons/messages.png 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); + } +} |