You are here

public function MySmsEventSubscriber::myEntityPhoneNumbers in SMS Framework 8

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

An example event subscriber.

See also

\Drupal\sms\Event\SmsEvents::ENTITY_PHONE_NUMBERS

File

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

Class

MySmsEventSubscriber
Event subscribers for SMS Framework.

Code

public function myEntityPhoneNumbers(\Drupal\sms\Event\SmsEntityPhoneNumber $event) {

  // Entity to get phone numbers for.
  $entity = $event
    ->getEntity();

  // Add a phone number for above entity.
  $event
    ->addPhoneNumber('+123456879');
}