You are here

function node_gallery_list_galleries_title in Node Gallery 6.3

Generates a title for use with hook_menu()'s title callback.

Parameters

object $account: A populated account object.

$content_type: (optional) The content type being displayed.

Return value

A string containing the title of the page.

1 string reference to 'node_gallery_list_galleries_title'
node_gallery_menu in ./node_gallery.module
Implements hook_menu().

File

./node_gallery.module, line 1191
Node gallery module file.

Code

function node_gallery_list_galleries_title($account, $content_type = NULL) {
  global $user;
  $values = array();
  if (is_string($account)) {
    $account = user_load(array(
      'name' => $account,
    ));
  }
  if (module_exists('realname')) {
    $account->name = theme('username', $account, array(
      'plain' => TRUE,
    ));
  }
  if ($user->uid != $account->uid) {
    $values['@user'] = $account->name;
  }
  if (!empty($content_type)) {
    $rel = node_gallery_get_relationship($content_type);
    $values['@gallery'] = $rel['settings']['name'];
  }
  if (array_key_exists('@user', $values)) {
    if (array_key_exists('@gallery', $values)) {
      return t('@user\'s @gallery Galleries', $values);
    }
    else {
      return t('@user\'s Galleries', $values);
    }
  }
  else {
    if (array_key_exists('@gallery', $values)) {
      return t('My @gallery Galleries', $values);
    }
    else {
      return t('My Galleries', $values);
    }
  }
}