You are here

function theme_sls_style_image in Service links 7.2

Same name and namespace in other branches
  1. 6.2 plugins/service_links_sprites.module \theme_sls_style_image()

File

plugins/service_links_sprites.module, line 183
Adds new styles based on sprites.

Code

function theme_sls_style_image($variables) {
  $text = $variables['text'];
  $url = $variables['url'];
  $image = $variables['image'];
  $nodelink = $variables['nodelink'];
  $attributes = $variables['attributes'];
  $width = sls_get_image_size(service_links_expand_path($image));
  $attributes['class'][] = "sprites service-links w{$width}";
  if ($nodelink) {
    $query = isset($url[1]) ? $url[1] : NULL;
    return array(
      'title' => '<span class="hide">' . $text . '</span>',
      'href' => $url[0],
      'query' => $query,
      'attributes' => $attributes,
      'html' => TRUE,
    );
  }
  else {
    $attributes = array_merge($attributes, array(
      'html' => TRUE,
    ));
    if (isset($url[1])) {
      $attributes['query'] = $url[1];
    }
    return l('<span class="hide">' . $text . '</span>', $url[0], $attributes);
  }
}