You are here

public function EventDispatcherCollection::executePaymentAccess in Payment 8.2

Checks access for before executing a payment.

Parameters

\Drupal\payment\Entity\PaymentInterface $payment: The payment that will be executed.

\Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface $payment_method: The payment method that will execute the payment.

\Drupal\Core\Session\AccountInterface $account: The account for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface

Overrides EventDispatcherInterface::executePaymentAccess

File

src/EventDispatcherCollection.php, line 69

Class

EventDispatcherCollection
Dispatches events to a collection of event dispatchers.

Namespace

Drupal\payment

Code

public function executePaymentAccess(PaymentInterface $payment, PaymentMethodInterface $payment_method, AccountInterface $account) {
  $access = AccessResult::neutral();
  foreach ($this->eventDispatchers as $event_dispatcher) {
    $access = $access
      ->orIf($event_dispatcher
      ->executePaymentAccess($payment, $payment_method, $account));
  }
  return $access;
}