1

I've upgraded Media module from 2.0-alpha2+6-dev and 2.0-beta1, however now I've the following error on some random pages:

( ! ) Fatal error: Call to undefined function `media_filter()` in my_module.module on line 224

My code in hook_field_formatter_view in my module is:

$element[0]['#markup']
  = '<div class="my-formatter-slide-down-container"><div class="text-summary ' . ($settings['hide_summary'] ? 'hiding' : '') . '">'
  . media_filter($text_summary)
  . '<a href="' . $read_more_link . '" class="read-more">' . $read_more_text . '</a>'
  . '</div></div>';

The code of that media_filter function was:

function media_filter($text) {
  $text = preg_replace_callback(MEDIA_TOKEN_REGEX, 'media_token_to_markup', $text);
  return $text;
}

What is the current replacement for that function which I can use instead?

1 Answer 1

4

Prior to newer version of Media, media_wysiwyg_filter should be used instead which will perform media markup filter. This can be found in modules/media_wysiwyg/includes/media_wysiwyg.filter.inc.

The code is:

/**
 * Filter callback for media markup filter.
 */
function media_wysiwyg_filter($text) {
  $text = preg_replace_callback(MEDIA_WYSIWYG_TOKEN_REGEX, 'media_wysiwyg_token_to_markup', $text);
  return $text;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.