You are here

function party_hat_party_add_form_wrapper in Party 8.2

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

Get the Party Add form with the correct hats pre set on the party.

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 render array

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

File

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

Code

function party_hat_party_add_form_wrapper($hats = '') {
  $hats = explode(' ', $hats);
  $party = entity_create('party', array(
    'label' => '',
  ));
  $items = array();

  // Build the hats field values array.
  foreach ($hats as $hat_name) {
    $items[] = array(
      'hat_name' => $hat_name,
    );
  }
  $party->party_hat['und'] = $items;
  module_load_include('inc', 'party', 'party.pages');
  return drupal_get_form('party_form', $party);
}