You are here

function taxonomy_manager_term_data_form_submit in Taxonomy Manager 7

1 string reference to 'taxonomy_manager_term_data_form_submit'
taxonomy_manager_term_data_form in ./taxonomy_manager.admin.inc

File

./taxonomy_manager.admin.inc, line 1763

Code

function taxonomy_manager_term_data_form_submit($form, &$form_state) {
  unset($form_state['values']['parents']);
  $old_term = taxonomy_term_load($form_state['values']['tid']);
  $term = taxonomy_form_term_submit_build_taxonomy_term($form, $form_state);

  // Submit handler for entity translations.
  taxonomy_manager_term_data_form_entity_translation_submit($form_state, $term);
  if ($term->weight != $old_term->weight) {
    form_set_value(array(
      '#parents' => array(
        'tree-update',
      ),
    ), array(
      'update' => TRUE,
    ), $form_state);
  }
  elseif ($term->name != $old_term->name) {
    form_set_value(array(
      '#parents' => array(
        'tree-update',
      ),
    ), array(
      'update-name' => array(
        'name' => $term->name,
        'tid' => $term->tid,
      ),
    ), $form_state);
  }
  elseif (isset($term->language) && $term->language != $old_term->language) {
    form_set_value(array(
      '#parents' => array(
        'tree-update',
      ),
    ), array(
      'update' => TRUE,
    ), $form_state);
  }
  taxonomy_term_save($term);
  drupal_set_message(t('Updated term data'));
  $form_state['rebuild'] = TRUE;
}