function party_activity_edit_form in Party 8.2
Form callback: create or edit a activity.
Parameters
$activity: The PartyActivity object to edit or for a create form fot an empty PartyActivity object with only a type defined.
1 string reference to 'party_activity_edit_form'
- party_activity_form_wrapper in modules/
party_activity/ party_activity.admin.inc - Form callback wrapper: create or edit a activity.
File
- modules/
party_activity/ party_activity.admin.inc, line 173 - Party Activity editing UI
Code
function party_activity_edit_form($form, &$form_state, $activity) {
// Add the default field elements.
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => isset($activity->title) ? $activity->title : '',
'#maxlength' => 255,
'#required' => TRUE,
'#weight' => -5,
);
// Add the field related form elements.
$form_state['party_activity'] = $activity;
field_attach_form('party_activity', $activity, $form, $form_state);
$form['actions'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'form-actions',
),
),
'#weight' => 400,
);
// We add the form's #submit array to this button along with the actual submit
// handler to preserve any submit handlers added by a form callback_wrapper.
$submit = array();
if (!empty($form['#submit'])) {
$submit += $form['#submit'];
}
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#submit' => $submit + array(
'party_activity_edit_form_submit',
),
);
if (!empty($activity->party_activity_id)) {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#suffix' => l(t('Cancel'), 'admin/community/activities'),
'#submit' => $submit + array(
'party_activity_form_submit_delete',
),
'#weight' => 45,
);
}
// We append the validate handler to #validate in case a form callback_wrapper
// is used to add validate handlers earlier.
$form['#validate'][] = 'party_activity_edit_form_validate';
return $form;
}