diff --git a/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc b/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc index 2790904c712482682eb3a8efd07871407e0931c4..79e3ba6659efbe919f6c7151d1cce4705a0c7349 100644 --- a/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc +++ b/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc @@ -140,6 +140,16 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL $match = str_replace("]]", "", $match); $tag = $match[0]; + // Drupal modules with email support often include site name in the subject line + // wrapped in brackets. With a token, this is rendered as "[[site:name]]". Such a + // format will cause a conflict with media_wysiwyg, which is looking for the same. + if (module_exists('token_filter')) { + $token_filter = _token_filter_filter_tokens('[' . $tag . ']', '', '', $langcode, NULL, NULL); + if ($token_filter != '[' . $tag . ']') { + return '[[' . $tag . ']]'; + } + } + try { if (!is_string($tag)) { throw new Exception('Unable to find matching tag');