function rules_ui_remove_event_submit

Submit the event configuration.

File

ui/ui.forms.inc, line 528

Code

function rules_ui_remove_event_submit($form, &$form_state) {
    $rules_config = $form_state['rules_config'];
    $rules_config->removeEvent($form_state['rules_event']);
    // Tell the user if this breaks something, but let him proceed.
    if (empty($rules_config->dirty)) {
        try {
            $rules_config->integrityCheck();
        } catch (RulesIntegrityException $e) {
            $warning = TRUE;
            drupal_set_message(t('Removed the event, but it had provided some variables which are now missing.'), 'warning');
        }
    }
    $rules_config->save();
    if (!isset($warning)) {
        drupal_set_message(t('Event %event has been removed.', array(
            '%event' => $form_state['event_label'],
        )));
    }
    $form_state['redirect'] = RulesPluginUI::path($rules_config->name);
}