class RemoveXFrameOptionsSubscriber in LTI Tool Provider 2.x
Same name and namespace in other branches
- 8 src/EventSubscriber/RemoveXFrameOptionsSubscriber.php \Drupal\lti_tool_provider\EventSubscriber\RemoveXFrameOptionsSubscriber
Hierarchy
- class \Drupal\lti_tool_provider\EventSubscriber\RemoveXFrameOptionsSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of RemoveXFrameOptionsSubscriber
1 string reference to 'RemoveXFrameOptionsSubscriber'
1 service uses RemoveXFrameOptionsSubscriber
File
- src/
EventSubscriber/ RemoveXFrameOptionsSubscriber.php, line 10
Namespace
Drupal\lti_tool_provider\EventSubscriberView source
class RemoveXFrameOptionsSubscriber implements EventSubscriberInterface {
/**
* @return array|mixed
*/
public static function getSubscribedEvents() : array {
$events[KernelEvents::RESPONSE][] = [
'RemoveXFrameOptions',
-10,
];
return $events;
}
/**
* @param ResponseEvent $event
*
* @todo Only add ResponseEvent typing to $event once D8 is no longer
* supported.
*/
public function RemoveXFrameOptions($event) {
if (Drupal::config('lti_tool_provider.settings')
->get('iframe')) {
$session = $event
->getRequest()
->getSession();
$context = $session
->get('lti_tool_provider_context');
if (!empty($context) && Drupal::currentUser()
->isAuthenticated()) {
$response = $event
->getResponse();
$response->headers
->remove('X-Frame-Options');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RemoveXFrameOptionsSubscriber:: |
public static | function | ||
RemoveXFrameOptionsSubscriber:: |
public | function | @todo Only add ResponseEvent typing to $event once D8 is no longer supported. |