Posts

Es werden Posts vom März, 2020 angezeigt.

Embed videos GDPR (DSGVO) compliant in Drupal 8

Bild
The following tutorial shows you how to prevent embedded youtube or vimeo videos from loading in Drupal 8. As long as the user has not accepted cookies, a banner with a preview of the video is shown instead of the video. Live-Version Why? GDPR (DSGVO) requires you to introduce another click before the video loads. That is because youtube sets cookies even before the video is started. After the click, the video embedded code should load. Components For this sample the following components are used. Drupal 8 Video Embed Field Module  (optional, could be any moduleto embedded videos) EU Cookie Compliance Module (could be any module for cookies) Step 1: Prevent Youtube from loading. To prevent YoutTube from loading we have to replace the src attribute of the IFrame with a data-src attribute. If you have embedded the video manual, you can edit it. If you use the Video Embed Field Module you can override the template by creating the following twig file in your t