Projet

Général

Profil

Révision a192dc0b

Ajouté par Assos Assos il y a environ 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/feeds/mappers/taxonomy.inc
85 85
 * Callback for mapping taxonomy terms.
86 86
 */
87 87
function taxonomy_feeds_set_target(FeedsSource $source, $entity, $target, array $terms, array $mapping) {
88
  $language = $mapping['language'];
89

  
88 90
  // Add in default values.
89 91
  $mapping += array(
90 92
    'term_search' => FEEDS_TAXONOMY_SEARCH_TERM_NAME,
......
118 120
    ->range(0, 1);
119 121

  
120 122

  
121
  $field = isset($entity->$target) ? $entity->$target : array('und' => array());
123
  $field = isset($entity->$target) ? $entity->$target : array($language => array());
124

  
125
  if (!isset($field[$language])) {
126
    $field[$language] = array();
127
  }
122 128

  
123 129
  // Allow for multiple mappings to the same target.
124
  $delta = count($field['und']);
130
  $delta = count($field[$language]);
125 131

  
126 132
  // Iterate over all values.
127 133
  foreach ($terms as $term) {
......
159 165
              'vid' => key($cache['allowed_vocabularies'][$target]),
160 166
              'vocabulary_machine_name' => reset($cache['allowed_vocabularies'][$target]),
161 167
            );
168
            // Set language if the taxonomy is multilingual.
169
            if ($language !== LANGUAGE_NONE) {
170
              $info = entity_get_info('taxonomy_term');
171
              if (!empty($info['entity keys']['language'])) {
172
                $term->{$info['entity keys']['language']} = $language;
173
              }
174
            }
162 175
            taxonomy_term_save($term);
163 176
            $tid = $term->tid;
164 177
            // Add to the list of allowed values.
......
181 194
    }
182 195

  
183 196
    if ($tid && isset($cache['allowed_values'][$target][$tid])) {
184
      $field['und'][] = array('tid' => $tid);
197
      $field[$language][] = array('tid' => $tid);
185 198
      $delta++;
186 199
    }
187 200
  }

Formats disponibles : Unified diff