You are here

function party_form in Party 7

Same name and namespace in other branches
  1. 8.2 party.pages.inc \party_form()

Party edit form.

3 string references to 'party_form'
party_add in ./party.pages.inc
Page callback for adding a party.
party_hat_party_add_form_wrapper in modules/party_hat/party_hat.pages.inc
Get the Party Add form with the correct hats pre set on the party.
party_menu in ./party.module
Implements hook_menu().

File

./party.pages.inc, line 47
party.pages.inc

Code

function party_form($form, &$form_state, $party, $op = 'edit') {

  // Manually add this file in incase its not already here.
  $form_state['build_info']['files']['form'] = drupal_get_path('module', 'party') . '/party.pages.inc';
  $form['#party'] = $party;
  if (isset($party->pid)) {
    $form['pid'] = array(
      '#type' => 'value',
      '#value' => $party->pid,
    );
    drupal_set_title(check_plain("Edit " . $party->label));
  }
  $form_state['#party'] = $party;
  $form_state['#party_unchanged'] = $party;

  // So that other modules can react to changes. Must be a better way
  // Set validate and submit handlers.
  $form['#validate'][] = 'party_edit_form_validate';
  $form['#submit'][] = 'party_edit_form_submit';

  // Attach data set forms.
  $data_sets = party_get_party_data_sets($party);
  foreach ($data_sets as $data_set) {

    // Get our controller
    $controller = $party
      ->getDataSetController($data_set);
    party_data_set_attach_form($form, $form_state, $controller);
  }
  field_attach_form('party', $party, $form, $form_state);
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#weight' => 99,
  );
  $form['#submit'][] = 'party_edit_form_save';
  return $form;
}