You are here

function rules_ui_add_event_page_submit in Rules 7.2

Submit the event configuration.

File

ui/ui.forms.inc, line 431
Rules User Interface forms.

Code

function rules_ui_add_event_page_submit($form, &$form_state) {
  rules_ui_add_event_apply($form, $form_state);
  $rules_config = $form_state['rules_config'];

  // 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('Added the event, but it does not provide all variables utilized.'), 'warning');
    }
  }
  $rules_config
    ->save();
  if (!isset($warning)) {
    $events = rules_fetch_data('event_info');
    $label = $events[$form_state['values']['event']]['label'];
    drupal_set_message(t('Added event %event.', array(
      '%event' => $label,
    )));
  }
}