public function BlazyOEmbed::checkInputUrl in Blazy 8.2
Checks the given input URL.
1 call to BlazyOEmbed::checkInputUrl()
- BlazyOEmbed::build in src/
BlazyOEmbed.php - Builds media-related settings based on the given media input url.
File
- src/
BlazyOEmbed.php, line 178
Class
- BlazyOEmbed
- Provides OEmbed integration.
Namespace
Drupal\blazyCode
public function checkInputUrl(array &$settings = []) {
$settings['input_url'] = UrlHelper::stripDangerousProtocols(trim($settings['input_url']));
// OEmbed Resource doesn't accept `/embed`, provides a conversion helper.
if (strpos($settings['input_url'], 'youtube.com/embed') !== FALSE) {
$search = '/youtube\\.com\\/embed\\/([a-zA-Z0-9]+)/smi';
$replace = "youtube.com/watch?v=\$1";
$settings['input_url'] = preg_replace($search, $replace, $settings['input_url']);
}
$settings['_input_url'] = TRUE;
}