You are here

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
stripe_examples_event_subscriber in modules/stripe_examples/stripe_examples.services.yml
\Drupal\stripe_examples\EventSubscriber\StripeExamplesEventSubscriber

File

modules/stripe_examples/src/EventSubscriber/StripeExamplesEventSubscriber.php, line 14

Namespace

Drupal\stripe_examples\EventSubscriber
View 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