You are here

function taxonomy_manager_form_add_submit in Taxonomy Manager 7

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form_add_submit()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_form_add_submit()

Submit handler for adding terms

1 string reference to 'taxonomy_manager_form_add_submit'
taxonomy_manager_add_form in ./taxonomy_manager.admin.inc
form for adding terms

File

./taxonomy_manager.admin.inc, line 1315

Code

function taxonomy_manager_form_add_submit($form, &$form_state) {
  $parents = isset($form_state['values']['taxonomy']['manager']['tree']['selected_terms']) ? $form_state['values']['taxonomy']['manager']['tree']['selected_terms'] : array();
  $lang = isset($form_state['values']['taxonomy']['manager']['top']['language']) ? $form_state['values']['taxonomy']['manager']['top']['language'] : "";
  $term_names_too_long = array();
  $new_terms = taxonomy_manager_mass_add_terms($form_state['values']['add']['mass_add'], $form_state['values']['voc']->vid, $parents, $lang, $term_names_too_long);
  $term_names = array();
  foreach ($new_terms as $term) {
    $term_names[] = $term->name;
  }
  if (module_exists('i18n_taxonomy') && !empty($lang) && i18n_taxonomy_vocabulary_mode($form_state['values']['voc']->vid, I18N_MODE_TRANSLATE)) {
    drupal_set_message(t("Saving terms to language @lang", array(
      '@lang' => locale_language_name($form_state['values']['taxonomy']['manager']['top']['language']),
    )));
  }
  if (count($term_names_too_long)) {
    drupal_set_message(t("Following term names were too long and truncated to 255 characters: %names.", array(
      '%names' => implode(', ', $term_names_too_long),
    )), 'warning');
  }
  drupal_set_message(t("Terms added: %terms", array(
    '%terms' => implode(', ', $term_names),
  )));
}