function forum_form_submit

Form submission handler for forum_form_forum() and forum_form_container().

2 string references to 'forum_form_submit'
forum_form_container in drupal/modules/forum/forum.admin.inc
Form constructor for adding and editing forum containers.
forum_form_forum in drupal/modules/forum/forum.admin.inc
Form constructor for adding and editing a forum.

File

drupal/modules/forum/forum.admin.inc, line 90
Administrative page callbacks for the Forum module.

Code

function forum_form_submit($form, &$form_state) {
  if ($form['form_id']['#value'] == 'forum_form_container') {
    $container = TRUE;
    $type = t('forum container');
  }
  else {
    $container = FALSE;
    $type = t('forum');
  }
  $term = (object) $form_state['values'];
  $status = taxonomy_term_save($term);
  switch ($status) {
    case SAVED_NEW:
      if ($container) {
        $containers = variable_get('forum_containers', array());
        $containers[] = $term->tid;
        variable_set('forum_containers', $containers);
      }
      $form_state['values']['tid'] = $term->tid;
      drupal_set_message(t('Created new @type %term.', array(
        '%term' => $form_state['values']['name'],
        '@type' => $type,
      )));
      break;
    case SAVED_UPDATED:
      drupal_set_message(t('The @type %term has been updated.', array(
        '%term' => $form_state['values']['name'],
        '@type' => $type,
      )));

      // Clear the page and block caches to avoid stale data.
      cache_clear_all();
      break;
  }
  $form_state['redirect'] = 'admin/structure/forum';
  return;
}