You are here

function hook_media_wysiwyg_token_to_markup_alter in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 modules/media_wysiwyg/media_wysiwyg.api.php \hook_media_wysiwyg_token_to_markup_alter()
  2. 7.3 modules/media_wysiwyg/media_wysiwyg.api.php \hook_media_wysiwyg_token_to_markup_alter()

Alter the output generated by Media filter tags.

Parameters

array $element: The renderable array of output generated for the filter tag.

array $tag_info: The filter tag converted into an associative array by media_token_to_markup() with the following elements:

  • 'fid': The ID of the media file being rendered.
  • 'file': The object from file_load() of the media file being rendered.
  • 'view_mode': The view mode being used to render the file.
  • 'attributes': An additional array of attributes that could be output with media_get_file_without_label().

array $settings: An additional array of settings.

  • 'wysiwyg': A boolean if the output is for the WYSIWYG preview or FALSE if for normal rendering.

See also

media_token_to_markup()

1 invocation of hook_media_wysiwyg_token_to_markup_alter()
media_wysiwyg_token_to_markup in modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
Convert a media token into HTML markup.

File

modules/media_wysiwyg/media_wysiwyg.api.php, line 67
Hooks provided by the Media WYSIWYG module.

Code

function hook_media_wysiwyg_token_to_markup_alter(&$element, $tag_info, $settings) {
  if (empty($settings['wysiwyg'])) {
    $element['#attributes']['alt'] = t('This media has been output using the @mode view mode.', array(
      '@mode' => $tag_info['view_mode'],
    ));
  }
}