class CourseWebformEventSubscriber in Course 3.x
Same name and namespace in other branches
- 8.3 modules/course_webform/src/EventSubscriber/CourseWebformEventSubscriber.php \Drupal\course_webform\EventSubscriber\CourseWebformEventSubscriber
- 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
File
- modules/
course_webform/ src/ EventSubscriber/ CourseWebformEventSubscriber.php, line 10
Namespace
Drupal\course_webform\EventSubscriberView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CourseWebformEventSubscriber:: |
public static | function | ||
CourseWebformEventSubscriber:: |
public | function | If the current node is a course object, fulfill it for the current user. |