You are here

function party_activity_modal_add_form_wrapper in Party 7

Modal add form wrapper.

Creates a new activity entity before passing it onto party_activity_modal_form_wrapper.

Parameters

string $type: (Optional) The machine name of the activity type to create.

$js:

1 string reference to 'party_activity_modal_add_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 285
Party Activity editing UI

Code

function party_activity_modal_add_form_wrapper($type = NULL, $js = FALSE) {
  $values = array();
  $info = entity_get_info('party_activity');
  if (!empty($type)) {
    $values['type'] = $type;
  }
  else {
    if (count($info['bundles']) === 1) {
      $values['type'] = key($info['bundles']);
    }
  }
  $activity = entity_create('party_activity', $values);
  return party_activity_modal_form_wrapper($activity, $js);
}