You are here

function theme_user_relationship_block_subject in User Relationships 6

Same name and namespace in other branches
  1. 5.2 plugins/user_relationship_blocks/user_relationship_blocks.module \theme_user_relationship_block_subject()
  2. 7 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_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 92
User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217

Code

function theme_user_relationship_block_subject($bid, $account, $rtid, $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', array(
        '@rel_name' => ur_tt("user_relationships:rtid:{$rtid}:name", $rtype->name),
        '@rel_plural_name' => $rtype->plural_name,
      ));
    }
    else {
      return t('@username is a @rel_name of', array(
        '@username' => $account->name,
        '@rel_name' => ur_tt("user_relationships:rtid:{$rtid}:name", $rtype->name),
        '@rel_plural_name' => $rtype->plural_name,
      ));
    }
  }
  else {
    global $user;
    $user_name = $account->uid == $user->uid ? 'My' : t("@username's", array(
      '@username' => $account->name,
    ));
    if ($rtid == UR_BLOCK_ALL_TYPES) {
      $output = $account->uid == $user->uid ? t('My relationships') : t("@username's relationships", array(
        '@username' => $account->name,
      ));
    }
    else {
      $rtype = user_relationships_type_load($rtid);
      $output = $account->uid == $user->uid ? t('My @relationships', array(
        '@relationships' => ur_tt("user_relationships:rtid:{$rtid}:plural_name", $rtype->plural_name),
      )) : t("@username's @relationships", array(
        '@username' => $account->name,
        '@relationships' => ur_tt("user_relationships:rtid:{$rtid}:plural_name", $rtype->plural_name),
      ));
    }
    return $output;
  }
}