<?php

function hook_yt_noorigin(&$codes, &$no_autolink_tags) {
    $found = false;
    $idx = 0;
    foreach ($codes as $code) {
        if ($code['tag'] == 'youtube') {
            $found = true;
            break;
        }
        $idx++;
    }
    if ($found) {
        // Everything except ?origin=
        $codes[$idx]['content'] = '<div class="videocontainer"><div><iframe frameborder="0" src="https://www.youtube-nocookie.com/embed/$1?wmode=opaque" data-youtube-id="$1" allowfullscreen loading="lazy"></iframe></div></div>';
    }
}

?>
