Projet

Général

Profil

Révision b3ab3446

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
158 158
      $file->{$key} = $value;
159 159
    }
160 160

  
161
    $attributes = is_array($tag_info['attributes']) ? $tag_info['attributes'] : array();
161
    if (array_key_exists('attributes', $tag_info) && is_array($tag_info['attributes'])) {
162
      $attributes = $tag_info['attributes'];
163
    }
164
    else {
165
      $attributes = array();
166
    }
162 167
    $attribute_whitelist = media_wysiwyg_allowed_attributes();
163 168
    $settings['attributes'] = array_intersect_key($attributes, array_flip($attribute_whitelist));
164 169
    $settings['fields'] = $fields;
......
202 207
    return '';
203 208
  }
204 209

  
210
  // Remove any alignment classes from $settings, because it will be added later
211
  // in this function to the media's wrapper, and we don't want to confuse CSS
212
  // by having it on both the wrapper and the element.
213
  if (isset($settings['attributes']['class'])) {
214
    $alignment_classes = array(
215
      'media-wysiwyg-align-left',
216
      'media-wysiwyg-align-right',
217
      'media-wysiwyg-align-center',
218
    );
219
    $settings['attributes']['class'] = array_diff($settings['attributes']['class'], $alignment_classes);
220
  }
221

  
205 222
  // If the tag has link text stored with it, override the filename with it for
206 223
  // the rest of this function, so that if the file is themed as a link, the
207 224
  // desired text will be used (see, for example, theme_file_link()).
......
283 300
      $element['#pre_render'][] = 'media_wysiwyg_pre_render_cached_filter';
284 301
    }
285 302
  }
303
  if (!empty($element['content']) && !empty($tag_info['fields']['alignment'])) {
304
    // Set a CSS class if an alignment has been specified and is correct.
305
    $alignment = $tag_info['fields']['alignment'];
306
    if (in_array($alignment, array('left', 'right', 'center'))) {
307
      $alignment_class = 'media-wysiwyg-align-' . $alignment;
308
      $element['content']['#attributes']['class'][] = $alignment_class;
309
    }
310
  }
286 311
  drupal_alter('media_wysiwyg_token_to_markup', $element, $tag_info, $settings, $langcode);
287 312
  $output = drupal_render($element);
288 313
  unset($recursion_stop[$file->fid]);

Formats disponibles : Unified diff