class StripeExamplesEventSubscriber in Stripe 2.x
Class EntityTypeSubscriber.
@package Drupal\stripe_examples\EventSubscriber
Hierarchy
- class \Drupal\stripe_examples\EventSubscriber\StripeExamplesEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of StripeExamplesEventSubscriber
2 string references to 'StripeExamplesEventSubscriber'
- StripeExamplesEventSubscriber::updatePayment in modules/
stripe_examples/ src/ EventSubscriber/ StripeExamplesEventSubscriber.php - React to a config object being saved.
- stripe_examples.services.yml in modules/
stripe_examples/ stripe_examples.services.yml - modules/stripe_examples/stripe_examples.services.yml
1 service uses StripeExamplesEventSubscriber
File
- modules/
stripe_examples/ src/ EventSubscriber/ StripeExamplesEventSubscriber.php, line 14
Namespace
Drupal\stripe_examples\EventSubscriberView source
class StripeExamplesEventSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*
* @return array
* The event names to listen for, and the methods that should be executed.
*/
public static function getSubscribedEvents() {
return [
StripeEvents::PAYMENT => 'updatePayment',
];
}
/**
* React to a config object being saved.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* Config crud event.
*/
public function updatePayment(StripePaymentEvent $event) {
$form = $event
->getForm();
if ($form['#form_id'] == 'stripe_examples_simple_checkout') {
$event
->setTotal(2500, 'StripeExamplesEventSubscriber');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StripeExamplesEventSubscriber:: |
public static | function | ||
StripeExamplesEventSubscriber:: |
public | function | React to a config object being saved. |