Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This issue is in reference to this issue, but a little different so i wanted to make another issue to track it.
In the other issue the problem was coming from the [embed] tag, however what I'm up against is the filter picking up the URL without the embed tag. The issue is that WYSIWYG always place a
tag on any new line. Since the function below is only looking for a patttern that matches http it rejects the string as a pattern match.
While its not idea for the module at large, is there anyway I can check for the pattern along with
to ensure that it always gets read and converted?
function oembed_filter_oembed_prepare($text, $filter, $format, $langcode, $cache, $cache_id) {
if ($filter->settings['autoembed']) {
$pattern = '|^\s*(https?://[^\s"]+)\s*$|im';
$text = preg_replace_callback($pattern, 'oembed_preg_auto_replace', $text);
}
return $text;
}
Comment | File | Size | Author |
---|---|---|---|
#3 | oembed-support_raw_urls.patch | 750 bytes | dman |
Comments
Comment #1
Media Crumb CreditAttribution: Media Crumb commentedNot sure if this is a good idea but i added the following to the function to strip out p tags
$text = preg_replace('/<p\b[^>]*>(.*?)<\/p>/i', '$1', $text);
Comment #2
Media Crumb CreditAttribution: Media Crumb commentedWell that doesn't work. Since I'm basically removing all the p tags from the text. Anyone have a solve for this?
Comment #3
dman CreditAttribution: dman commentedI actually did this today.
I didn't push it back here at the time, because I'm confused about what the game plan is for #2269433: Support URLs on a line by themselves in ckeditor/WYSIWYG
But I needed something that just works for us for now.
Comment #4
bennos CreditAttribution: bennos commentedyour patch is wrong. you try to patch oembed.module file but the function is in oembed.filter.inc
Comment #5
dman CreditAttribution: dman commentedI'm sure what you mean to politely say is:
Comment #6
bennos CreditAttribution: bennos commentedyeah, sorry.
Was a little bit frustrated and so diplomatic yesterday.