You are here

function party_activity_form_wrapper in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_activity/party_activity.admin.inc \party_activity_form_wrapper()

Form callback wrapper: create or edit a activity.

Parameters

$activity: The PartyActivity object being edited by this form.

See also

party_activity_edit_form()

1 string reference to 'party_activity_form_wrapper'
PartyActivityUIController::hook_menu in modules/party_activity/party_activity.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu is optimized for entity type administration.

File

modules/party_activity/party_activity.admin.inc, line 132
Party Activity editing UI

Code

function party_activity_form_wrapper($activity) {

  // Add the breadcrumb for the form's location.
  party_activity_set_breadcrumb();

  // If its a new activity we can take arguments from the URL to make it quicker to assign
  if (!empty($activity->is_new) && $activity->is_new) {
    $assignee = !empty($_GET['assignee']) ? $_GET['assignee'] : NULL;
    $participants = !empty($_GET['participants']) ? explode(',', $_GET['participants']) : array();
    if (!empty($assignee)) {
      $activity->activity_assigned_to['und'][]['target_id'] = $assignee;
    }
    foreach ($participants as $participant_id) {
      $activity->activity_participants['und'][]['target_id'] = $participant_id;
    }
  }
  return drupal_get_form('party_activity_edit_form', $activity);
}