You are here

public function MySmsEventSubscriber::mySmsMessageGateway in SMS Framework 8

Same name and namespace in other branches
  1. 2.x sms.api.php \MySmsEventSubscriber::mySmsMessageGateway()
  2. 2.1.x sms.api.php \MySmsEventSubscriber::mySmsMessageGateway()

An example event subscriber.

See also

\Drupal\sms\Event\SmsEvents::MESSAGE_GATEWAY

File

./sms.api.php, line 90
SMS Framework hooks.

Class

MySmsEventSubscriber
Event subscribers for SMS Framework.

Code

public function mySmsMessageGateway(\Drupal\sms\Event\RecipientGatewayEvent $event) {

  // The recipient phone number.
  $event
    ->getRecipient();

  // Add a gateway for a phone number.
  $event
    ->addGateway($a_gateway);

  // Add a gateway with a priority.
  $event
    ->addGateway($a_gateway, 333);
  $event
    ->addGateway($a_gateway, -333);
}