You are here

function activity_configure_handler_form_submit in Activity 7

Form submit handler for the configuration form.

File

./activity.admin.inc, line 199
activity.admin.inc Contains administrative forms for activity.module

Code

function activity_configure_handler_form_submit($form, &$form_state) {
  $params = array(
    'aid' => $form['#actions_id'],
    'options' => $form_state['values']['options'],
    'templates' => $form_state['values']['messages'],
  );
  actions_save('activity_record', 'activity', $params, $form_state['values']['label'], $form['#actions_id']);
  if ($form_state['values']['op'] == t('Save and Update Existing')) {
    $batch = array(
      'title' => t('Regenerating @label messages', array(
        '@label' => $form_state['values']['label'],
      )),
      'operations' => array(
        array(
          'activity_recreate_messages_step',
          array(
            $form['#actions_id'],
          ),
        ),
      ),
      'file' => drupal_get_path('module', 'activity') . '/activity.batch.inc',
    );
    batch_set($batch);
  }
  elseif ($form_state['values']['op'] == t('Save and Create')) {
    $batch = array(
      'title' => t('Generating @label messages', array(
        '@label' => $form_state['values']['label'],
      )),
      'operations' => array(
        array(
          'activity_batch_regenerate_step',
          array(
            $form['#actions_id'],
          ),
        ),
      ),
      'file' => drupal_get_path('module', 'activity') . '/activity.batch.inc',
    );
    batch_set($batch);
  }
}