class KillXFrameOptions in Acquia Content Hub 8.2
Removes the x-frame-options header from previews.
@package Drupal\acquia_contenthub_preview\EventSubscriber\KernelResponse
Hierarchy
- class \Drupal\acquia_contenthub_preview\EventSubscriber\KernelResponse\KillXFrameOptions implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of KillXFrameOptions
1 string reference to 'KillXFrameOptions'
- acquia_contenthub_preview.services.yml in modules/acquia_contenthub_preview/ acquia_contenthub_preview.services.yml 
- modules/acquia_contenthub_preview/acquia_contenthub_preview.services.yml
1 service uses KillXFrameOptions
File
- modules/acquia_contenthub_preview/ src/ EventSubscriber/ KernelResponse/ KillXFrameOptions.php, line 14 
Namespace
Drupal\acquia_contenthub_preview\EventSubscriber\KernelResponseView source
class KillXFrameOptions implements EventSubscriberInterface {
  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    // Adds the event in the list of KernelEvents::RESPONSE with priority -10.
    $events[KernelEvents::RESPONSE][] = [
      'onKernelResponse',
      -10,
    ];
    return $events;
  }
  /**
   * Filter X-Frame-Options on Kernel Response.
   *
   * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
   *   The Filter Response Event.
   */
  public function onKernelResponse(FilterResponseEvent $event) {
    $response = $event
      ->getResponse();
    $response->headers
      ->remove('X-Frame-Options');
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| KillXFrameOptions:: | public static | function | Returns an array of event names this subscriber wants to listen to. | |
| KillXFrameOptions:: | public | function | Filter X-Frame-Options on Kernel Response. | 
