You are here

function theme_user_relationship_block_subject in User Relationships 7

Same name and namespace in other branches
  1. 5.2 plugins/user_relationship_blocks/user_relationship_blocks.module \theme_user_relationship_block_subject()
  2. 6 user_relationship_blocks/user_relationship_blocks.module \theme_user_relationship_block_subject()

Theme function to generate the title of a block

1 theme call to theme_user_relationship_block_subject()
user_relationship_blocks_block_view in user_relationship_blocks/user_relationship_blocks.module
helper function user_relationship_blocks_block delegates to when $op == 'view'

File

user_relationship_blocks/user_relationship_blocks.module, line 59
User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217

Code

function theme_user_relationship_block_subject($variables) {
  $bid = $variables['bid'];
  $account = $variables['account'];
  $rtid = $variables['rtid'];
  $extra = $variables['extra'];
  if ($bid == 'pending') {
    return t('Relationship requests');
  }
  elseif ($bid == 'actions') {
    return t('Relationship actions');
  }
  elseif ($extra == 'you_to_them') {
    global $user;
    $rtype = user_relationships_type_load($rtid);
    if ($account->uid == $user->uid) {
      return t('I am a @rel_name of', user_relationships_type_translations($rtype));
    }
    else {
      return t('@username is a @rel_name of', array(
        '@username' => format_username($account),
      ) + user_relationships_type_translations($rtype));
    }
  }
  else {
    global $user;
    if ($rtid == UR_BLOCK_ALL_TYPES) {
      $output = $account->uid == $user->uid ? t('My relationships') : t("@username's relationships", array(
        '@username' => format_username($account),
      ));
    }
    else {
      $rtype = user_relationships_type_load($rtid);
      $output = $account->uid == $user->uid ? t('My @rel_name', user_relationships_type_translations($rtype)) : t("@username's @rel_name", array(
        '@username' => format_username($account),
      ) + user_relationships_type_translations($rtype));
    }
    return $output;
  }
}