forum_form_submit
function forum_form_submit
forum_form_submit($form, &$form_state)
Form submission handler for forum_form_forum() and forum_form_container().
File
- 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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!forum!forum.admin.inc/function/forum_form_submit/7.x