You are here

function bat_booking_form_submit_delete in Booking and Availability Management Tools for Drupal 7

Form API submit callback for the delete button.

1 string reference to 'bat_booking_form_submit_delete'
bat_booking_edit_form in modules/bat_booking/bat_booking.admin.inc
Generates the booking editing form.

File

modules/bat_booking/bat_booking.admin.inc, line 357
BatBooking editing UI.

Code

function bat_booking_form_submit_delete(&$form, &$form_state) {
  if (isset($form_state['ajax'])) {
    bat_booking_delete($form_state['bat_booking']);
    drupal_set_message(t('The booking has been removed'));
    $form_state['booking_deleted'] = TRUE;
  }
  else {
    $destination = array();
    if (isset($_GET['destination'])) {
      $destination = drupal_get_destination();
      unset($_GET['destination']);
    }
    $form_state['redirect'] = array(
      'admin/bat/config/booking/manage/' . $form_state['bat_booking']->booking_id . '/delete',
      array(
        'query' => $destination,
      ),
    );
  }
}