You are here

function party_hat_party_add_title in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_hat/party_hat.pages.inc \party_hat_party_add_title()

Get the add page title.

This is only called if no title was explicitly set in the add page config.

Parameters

string $hats: The hats the party should have initially, in a string formatted as "hat_name_1 hat_name_2"

Return value

The page title.

1 string reference to 'party_hat_party_add_title'
party_hat_menu in modules/party_hat/party_hat.module
Implements hook_menu().

File

modules/party_hat/party_hat.pages.inc, line 18
Page and Page title callbacks

Code

function party_hat_party_add_title($hats = '') {
  $hats = explode(' ', $hats);
  $title = 'Add ';

  // Generate a page title using the hats.
  // If there's only one hat set, the title should be 'Add $hat->label'
  if (count($hats) == 1) {
    $title .= party_hat_load($hats[0])->label;
  }
  else {
    $title .= 'Party';
    $hats = entity_load_multiple_by_name('party_hat', $hats);
    if (count($hats)) {
      $title .= ' [';
      foreach ($hats as $name => $hat) {
        $hats[$name] = $hat->label;
      }
      $title .= implode(', ', $hats);
      $title .= ']';
    }
  }
  return $title;
}