public function PhoneNumberVerification::getPhoneNumberSettingsForEntity in SMS Framework 2.x
Same name and namespace in other branches
- 8 src/Provider/PhoneNumberVerification.php \Drupal\sms\Provider\PhoneNumberVerification::getPhoneNumberSettingsForEntity()
- 2.1.x src/Provider/PhoneNumberVerification.php \Drupal\sms\Provider\PhoneNumberVerification::getPhoneNumberSettingsForEntity()
Gets phone number settings for the bundle of an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to get settings.
Return value
\Drupal\sms\Entity\PhoneNumberSettingsInterface|null A phone number settings entity, or NULL if it does not exist.
Throws
\Drupal\sms\Exception\PhoneNumberSettingsException Thrown if entity is not configured for phone numbers.
Overrides PhoneNumberVerificationInterface::getPhoneNumberSettingsForEntity
4 calls to PhoneNumberVerification::getPhoneNumberSettingsForEntity()
- PhoneNumberVerification::deletePhoneVerificationByEntity in src/
Provider/ PhoneNumberVerification.php - Deletes phone number verifications for an entity.
- PhoneNumberVerification::newPhoneVerification in src/
Provider/ PhoneNumberVerification.php - Generates a phone number verification for an entity and phone number pair.
- PhoneNumberVerification::purgeExpiredVerifications in src/
Provider/ PhoneNumberVerification.php - Cleans up expired phone number verifications.
- PhoneNumberVerification::updatePhoneVerificationByEntity in src/
Provider/ PhoneNumberVerification.php - Detect modifications to phone numbers on an entity.
File
- src/
Provider/ PhoneNumberVerification.php, line 102
Class
- PhoneNumberVerification
- Phone number verification provider.
Namespace
Drupal\sms\ProviderCode
public function getPhoneNumberSettingsForEntity(EntityInterface $entity) {
if (!($phone_number_settings = $this
->getPhoneNumberSettings($entity
->getEntityTypeId(), $entity
->bundle()))) {
throw new PhoneNumberSettingsException(sprintf('Entity phone number config does not exist for bundle %s:%s', $entity
->getEntityTypeId(), $entity
->bundle()));
}
return $phone_number_settings;
}