Projet

Général

Profil

Révision 41cc1b08

Ajouté par Assos Assos il y a presque 9 ans

Update feeds 7.x-2.0-alpha9 -> 7.x-2.0-beta1

Install lib simplepie 1.3.1

Voir les différences:

drupal7/sites/all/modules/feeds/plugins/FeedsTermProcessor.inc
34 34
    $term = new stdClass();
35 35
    $term->vid = $vocabulary->vid;
36 36
    $term->vocabulary_machine_name = $vocabulary->machine_name;
37
    $term->format = isset($this->config['input_format']) ? $this->config['input_format'] : filter_fallback_format();
38 37
    return $term;
39 38
  }
40 39

  
......
84 83
  }
85 84

  
86 85
  /**
87
   * Override setTargetElement to operate on a target item that is a taxonomy term.
86
   * Overrides parent::setTargetElement().
87
   *
88
   * Operate on a target item that is a taxonomy term.
88 89
   */
89
  public function setTargetElement(FeedsSource $source, $target_term, $target_element, $value) {
90
  public function setTargetElement(FeedsSource $source, $target_term, $target_element, $value, array $mapping = array()) {
90 91
    switch ($target_element) {
91 92
      case 'parent':
92 93
        if (!empty($value)) {
......
108 109
          $target_term->parent[] = 0;
109 110
        }
110 111
        break;
112

  
111 113
      case 'parentguid':
112 114
        // value is parent_guid field value
113 115
        $query = db_select('feeds_item')
......
115 117
          ->condition('entity_type', $this->entityType());
116 118
        $parent_tid = $query->condition('guid', $value)->execute()->fetchField();
117 119
        $target_term->parent[] = ($parent_tid) ? $parent_tid : 0;
118

  
119 120
        break;
121

  
120 122
      case 'weight':
121 123
        if (!empty($value)) {
122 124
          $weight = intval($value);
......
126 128
        }
127 129
        $target_term->weight = $weight;
128 130
        break;
131

  
132
      case 'description':
133
        if (!empty($mapping['format'])) {
134
          $target_term->format = $mapping['format'];
135
        }
136
        elseif (!empty($this->config['input_format'])) {
137
          $target_term->format = $this->config['input_format'];
138
        }
139
        else {
140
          $target_term->format = filter_fallback_format();
141
        }
142
        $target_term->description = $value;
143
        break;
144

  
129 145
      default:
130 146
        parent::setTargetElement($source, $target_term, $target_element, $value);
131 147
        break;
......
161 177
      'description' => array(
162 178
        'name' => t('Term description'),
163 179
        'description' => t('Description of the taxonomy term.'),
180
        'summary_callbacks' => array('text_feeds_summary_callback'),
181
        'form_callbacks' => array('text_feeds_form_callback'),
164 182
      ),
165 183
    );
166 184

  
167
    // Let implementers of hook_feeds_term_processor_targets() add their targets.
168
    try {
169
      self::loadMappers();
170
      $entity_type = $this->entityType();
171
      $bundle = $this->bundle();
172
      drupal_alter('feeds_processor_targets', $targets, $entity_type, $bundle);
173
    }
174
    catch (Exception $e) {
175
      // Do nothing.
176
    }
185
    $this->getHookTargets($targets);
186

  
177 187
    return $targets;
178 188
  }
179 189

  
......
206 216
    }
207 217
    throw new Exception(t('No vocabulary defined for Taxonomy Term processor.'));
208 218
  }
219

  
220
  /**
221
   * Overrides FeedsProcessor::dependencies().
222
   */
223
  public function dependencies() {
224
    $dependencies = parent::dependencies();
225
    $dependencies['taxonomy'] = 'taxonomy';
226
    return $dependencies;
227
  }
228

  
209 229
}

Formats disponibles : Unified diff