You are here

function bat_type_add_units_form_wrapper in Booking and Availability Management Tools for Drupal 7

Form callback wrapper: create units associated with a type.

Parameters

$type: The type of units to create

1 string reference to 'bat_type_add_units_form_wrapper'
BatTypeUIController::hook_menu in modules/bat_unit/bat_type.admin.inc
Overrides hook_menu() defaults.

File

modules/bat_unit/bat_type.admin.inc, line 390
BatType editing UI.

Code

function bat_type_add_units_form_wrapper($type, $unit_type) {
  global $user;

  // Add the breadcrumb for the form's location.
  bat_type_set_breadcrumb();
  $unit_model = bat_unit_create(array(
    'type' => $unit_type,
    'uid' => $user->uid,
  ));
  $unit_model->type_id = $type->type_id;
  $unit_model->created = REQUEST_TIME;
  $unit_model->author_name = $user->name;
  $unit_model->status = 1;
  return drupal_get_form('bat_type_add_units_form', $unit_model);
}