You are here

public function PhoneNumberProvider::getPhoneNumbers in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Provider/PhoneNumberProvider.php \Drupal\sms\Provider\PhoneNumberProvider::getPhoneNumbers()
  2. 2.1.x src/Provider/PhoneNumberProvider.php \Drupal\sms\Provider\PhoneNumberProvider::getPhoneNumbers()

Gets phone numbers for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity to get phone numbers.

bool|null $verified: Whether the returned phone numbers must be verified, or NULL to get all phone numbers regardless of status.

Return value

string[] An array of phone numbers.

Overrides PhoneNumberProviderInterface::getPhoneNumbers

1 call to PhoneNumberProvider::getPhoneNumbers()
PhoneNumberProvider::sendMessage in src/Provider/PhoneNumberProvider.php
Sends an SMS to an entity.

File

src/Provider/PhoneNumberProvider.php, line 49

Class

PhoneNumberProvider
Phone number provider.

Namespace

Drupal\sms\Provider

Code

public function getPhoneNumbers(EntityInterface $entity, $verified = TRUE) {
  $event = new SmsEntityPhoneNumber($entity, $verified);

  /** @var \Drupal\sms\Event\SmsEntityPhoneNumber $event */
  $event = $this->eventDispatcher
    ->dispatch(SmsEvents::ENTITY_PHONE_NUMBERS, $event);
  return $event
    ->getPhoneNumbers();
}