You are here

class CourseWebformEventSubscriber in Course 3.x

Same name and namespace in other branches
  1. 8.3 modules/course_webform/src/EventSubscriber/CourseWebformEventSubscriber.php \Drupal\course_webform\EventSubscriber\CourseWebformEventSubscriber
  2. 8.2 modules/course_webform/src/EventSubscriber/CourseWebformEventSubscriber.php \Drupal\course_webform\EventSubscriber\CourseWebformEventSubscriber

Hierarchy

  • class \Drupal\course_webform\EventSubscriber\CourseWebformEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of CourseWebformEventSubscriber

1 string reference to 'CourseWebformEventSubscriber'
course_webform.services.yml in modules/course_webform/course_webform.services.yml
modules/course_webform/course_webform.services.yml
1 service uses CourseWebformEventSubscriber
course_webform_event_subscriber in modules/course_webform/course_webform.services.yml
\Drupal\course_webform\EventSubscriber\CourseWebformEventSubscriber

File

modules/course_webform/src/EventSubscriber/CourseWebformEventSubscriber.php, line 10

Namespace

Drupal\course_webform\EventSubscriber
View source
class CourseWebformEventSubscriber implements EventSubscriberInterface {
  public static function getSubscribedEvents() {
    return [
      KernelEvents::REQUEST => [
        'onRequest',
        28,
      ],
    ];
  }

  /**
   * If the current node is a course object, fulfill it for the current user.
   *
   * @param GetResponseEvent $event
   */
  public function onRequest(GetResponseEvent $event) {
    $route_match = Drupal::routeMatch();
    if ($route_match
      ->getRouteName() == 'entity.webform.canonical') {
      $webform = $route_match
        ->getParameter('webform');

      // Process fulfillment or something
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CourseWebformEventSubscriber::getSubscribedEvents public static function
CourseWebformEventSubscriber::onRequest public function If the current node is a course object, fulfill it for the current user.