Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created June 4, 2014 19:06
Show Gist options
  • Save EclipseGc/f9a8d46101f462bca857 to your computer and use it in GitHub Desktop.
Save EclipseGc/f9a8d46101f462bca857 to your computer and use it in GitHub Desktop.
<?php
class HttpStatusCodePageVariant {
public function render() {
$status_code = $this->configuration['status_code'];
$dispatcher = \Drupal::service('event_dispatcher');
$event = new PageManagerViewEvent();
$event->setStatusCode($status_code);
$dispatcher->dispatch(PageManagerEvents::VIEW, $event);
return new Response($event->getContent(), $event->getStatusCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment