Commit a542033a authored by Dave Lane's avatar Dave Lane
Browse files

initial commit of new Drupal module designed to allow H5P embedding on external sites

This fix should allow embedding H5P objects from this site on other sites, like our course and WPMS WordPress multisites.
Dave ( 20200616)
name: Allow H5P Object embedding
description: For a Drupal8 site offering a library of H5P ( learning objects for external embedding, we need to override Drupal8's default X-Frame-Options header setting of "SAMEORIGIN" which prohibits embedding content. So, only in the case of H5P objects, which have a path starting with /h5p/[ID]/embed, we remove that header.
package: OERu Custom
type: module
core: 8.x
class: Drupal\mymodule\EventSubscriber\RemoveXFrameOptionsSubscriber
- { name: event_subscriber }
namespace Drupal\mymodule\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class RemoveXFrameOptionsSubscriber implements EventSubscriberInterface {
public function RemoveXFrameOptions(FilterResponseEvent $event) {
$response = $event->getResponse();
if (preg_match('/^\/h5p\/[0-9]+\/embed$/', $event->getRequest()->getPathInfo())) {
public static function getSubscribedEvents() {
$events[KernelEvents::RESPONSE][] = array('RemoveXFrameOptions', -10);
return $events;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment