You are here

function party_hat_has_hat in Party 7

Determine whether a party has a given hat.

Parameters

Party $party: The party to check.

PartyHat|string $hat: Party Hat or hat name.

Return value

bool Returns True if the party has the hat and false otherwise.

File

modules/party_hat/party_hat.module, line 270
party_hat.module Provides an extensible access system for parties.

Code

function party_hat_has_hat($party, $hat) {
  if (is_object($hat)) {
    $hat = $hat->name;
  }
  if (empty($party->party_hat[LANGUAGE_NONE])) {
    return FALSE;
  }
  foreach ($party->party_hat[LANGUAGE_NONE] as $item) {
    if ($item['hat_name'] == $hat) {
      return TRUE;
    }
  }
  return FALSE;
}