Projet

Général

Profil

Révision 01f36513

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
756 756
  // Add language field or not depending on taxonomy mode.
757 757
  switch (i18n_taxonomy_vocabulary_mode($vocabulary->vid)) {
758 758
    case I18N_MODE_TRANSLATE:
759
      // Set $form_state['storage'] default as empty array because we will add
760
      // the translation and target from $_GET. So we still have it when the
761
      // page partially reloads with ajax.
762
      if(!isset($form_state['storage'])) {
763
        $form_state['storage'] = array();
764
      }
765
      // get translation from $_GET or $form_state['storage']
766
      $translation = null;
767
      if(isset($_GET['translation'])) {
768
        $translation = $_GET['translation'];
769
        $form_state['storage']['translation'] = $translation;
770
      } else if(isset($form_state['storage']) && isset($form_state['storage']['translation'])){
771
        $translation = $form_state['storage']['translation'];
772
      }
773
      // get target from $_GET or $form_state['storage']
774
      $target = null;
775
      if(isset($_GET['target'])) {
776
        $target = $_GET['target'];
777
        $form_state['storage']['target'] = $target;
778
      } else if(isset($form_state['storage']) && isset($form_state['storage']['target'])){
779
        $target = $form_state['storage']['target'];
780
      }
759 781
      $form['language'] = array(
760 782
        '#description' => t('This term belongs to a multilingual vocabulary. You can set a language for it.'),
761 783
      ) + i18n_element_language_select($term);
......
763 785
      // If the term to be added will be a translation of a source term,
764 786
      // set the default value of the option list to the target language and
765 787
      // create a form element for storing the translation set of the source term.
766
      if (empty($term->tid) && isset($_GET['translation']) && isset($_GET['target']) && ($source_term = taxonomy_term_load($_GET['translation'])) && ($target_language = i18n_language_object($_GET['target']))) {
788
      if (empty($term->tid) && isset($translation) && isset($target) && ($source_term = taxonomy_term_load($translation)) && ($target_language = i18n_language_object($target))) {
767 789
        // Set context language to target language.
768 790
        i18n_language_context($target_language);
769 791

  

Formats disponibles : Unified diff