summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorron_s2018-08-17 21:43:29 (GMT)
committerJoseph Olstad2018-08-17 21:43:54 (GMT)
commitc4c341ca7e216ec49db8c16ed5bef482d9fa8461 (patch)
tree2564236ad8a8f391ea22af5c463e8a28f949dea1
parentcb4aa587eca640e73866b0613efe8ed5de4b7ae4 (diff)
Issue #2989181 by ron_s: Double brackets filter error
-rw-r--r--modules/media_wysiwyg/includes/media_wysiwyg.filter.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc b/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
index 2790904..79e3ba6 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');