You are here

function i18ntaxonomy_translation_term_form in Internationalization 6

Produces a vocabulary translation form.

1 string reference to 'i18ntaxonomy_translation_term_form'
i18ntaxonomy_page_vocabulary in i18ntaxonomy/i18ntaxonomy.admin.inc
This is the callback for taxonomy translations.

File

i18ntaxonomy/i18ntaxonomy.admin.inc, line 33
Helper functions for taxonomy administration.

Code

function i18ntaxonomy_translation_term_form($form_state, $vid, $trid = NULL, $edit = array()) {
  $languages = i18n_supported_languages();
  if ($trid == 'new') {
    $translations = array();
    $form['trid'] = array(
      '#type' => 'hidden',
      '#value' => 0,
    );
  }
  else {
    $form['trid'] = array(
      '#type' => 'hidden',
      '#value' => $trid,
    );
    $translations = i18ntaxonomy_term_get_translations(array(
      'trid' => $trid,
    ));
  }
  $vocabulary = taxonomy_vocabulary_load($vid);

  // List of terms for languages.
  foreach ($languages as $lang => $langname) {
    $current = isset($translations[$lang]) ? $translations[$lang]->tid : '';
    $tree = i18ntaxonomy_get_tree($vid, $lang);
    $form[$lang] = array(
      '#type' => 'fieldset',
      '#tree' => TRUE,
    );
    $form[$lang]['tid'] = _i18ntaxonomy_term_select($langname, $current, $tree);
    $form[$lang]['old'] = array(
      '#type' => 'hidden',
      '#value' => $current,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  if ($trid != 'new') {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
  }
  $form['destination'] = array(
    '#type' => 'hidden',
    '#value' => 'admin/content/taxonomy/' . arg(3) . '/translation',
  );
  return $form;
}