You are here

function theme_content_profile_imagecache_formatter_userlink in Content Profile 6

Imagecache formatter.

1 string reference to 'theme_content_profile_imagecache_formatter_userlink'
content_profile_theme in ./content_profile.module
Implementation of hook_theme().

File

./content_profile.theme.inc, line 78
Theme and template preprocessing code

Code

function theme_content_profile_imagecache_formatter_userlink($element) {

  // Inside a view $element may contain NULL data. In that case, just return.
  if (empty($element['#item']['fid'])) {
    return '';
  }

  // Extract the preset name from the formatter name.
  $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
  $style = 'userlink';
  $item = $element['#item'];
  $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
  $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
  $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']);
  $path = empty($item['uid']) ? '' : 'user/' . $item['uid'];
  $class = "imagecache imagecache-{$presetname} imagecache-{$style} imagecache-{$element['#formatter']}";
  return l($imagetag, $path, array(
    'attributes' => array(
      'class' => $class,
    ),
    'html' => TRUE,
  ));
}