You are here

function theme_heartbeat_activity_avatar in Heartbeat 7

The function for the avatar in a heartbeat activity message.

1 theme call to theme_heartbeat_activity_avatar()
heartbeat_heartbeat_activity_view in ./heartbeat.module
Implements hook_heartbeat_activity_view().

File

./heartbeat.module, line 1294
Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.

Code

function theme_heartbeat_activity_avatar($variables) {
  $filepath = $variables['uri'];
  $alt = t("@user's picture", array(
    '@user' => format_username($variables['heartbeatactivity']->actor),
  ));
  if (module_exists('image') && file_valid_uri($filepath)) {
    $markup = theme('image_style', array(
      'style_name' => 'activity_avatar',
      'path' => $filepath,
      'alt' => $alt,
      'title' => $alt,
      'attributes' => array(
        'class' => 'avatar',
      ),
    ));
  }
  else {
    $markup = theme('image', array(
      'path' => $filepath,
      'alt' => $alt,
      'title' => $alt,
      'attributes' => array(
        'class' => 'avatar',
      ),
    ));
  }
  return array(
    '#markup' => $markup,
  );
}