You are here

function media_pre_render_text_format in D7 Media 7

Builds a map of media tags in the element being rendered to their rendered HTML.

The map is stored in JS, so we can transform them when the editor is being displayed.

Parameters

array $element:

1 string reference to 'media_pre_render_text_format'
media_element_info_alter in ./media.module
Implements hook_element_info_alter().

File

includes/media.filter.inc, line 413
Functions related to the WYSIWYG editor and the media input filter.

Code

function media_pre_render_text_format($element) {

  // filter_process_format() copies properties to the expanded 'value' child
  // element.
  if (!isset($element['format'])) {
    return $element;
  }
  $field =& $element['value'];
  $settings = array(
    'field' => $field['#id'],
  );
  $tagmap = _media_generate_tagMap($field['#value']);
  if (isset($tagmap)) {
    drupal_add_js(array(
      'tagmap' => $tagmap,
    ), 'setting');
  }
  return $element;
}