You are here

function bat_event_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_event_form_submit_delete'
bat_event_edit_form in modules/bat_event/bat_event.admin.inc
Form callback: create or edit a event.

File

modules/bat_event/bat_event.admin.inc, line 530
Unit event editing UI.

Code

function bat_event_form_submit_delete($form, &$form_state) {
  if (isset($form_state['ajax'])) {
    $event = bat_event_load($form_state['bat_event']->event_id, TRUE);
    bat_event_delete($event);
    drupal_set_message(t('The event has been removed'));
    $form_state['event_deleted'] = TRUE;
  }
  else {
    $destination = array();
    if (isset($_GET['destination'])) {
      $destination = drupal_get_destination();
      unset($_GET['destination']);
    }
    $form_state['redirect'] = array(
      'admin/bat/events/event/' . $form_state['bat_event']->event_id . '/delete',
      array(
        'query' => $destination,
      ),
    );
  }
}