protected function AccountRegistration::removeAcceptableViolations in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/src/AccountRegistration.php \Drupal\sms_user\AccountRegistration::removeAcceptableViolations()
- 2.1.x modules/sms_user/src/AccountRegistration.php \Drupal\sms_user\AccountRegistration::removeAcceptableViolations()
Filter out acceptable validation errors.
Parameters
\Drupal\Core\Entity\EntityConstraintViolationListInterface $violations: A violation list.
string|null $incoming_form: Incoming form, if applicable.
Return value
\Drupal\Core\Entity\EntityConstraintViolationListInterface A filtered violation list.
2 calls to AccountRegistration::removeAcceptableViolations()
- AccountRegistration::allUnknownNumbers in modules/
sms_user/ src/ AccountRegistration.php - Process incoming message and create a user if the phone number is unknown.
- AccountRegistration::incomingPatternMessage in modules/
sms_user/ src/ AccountRegistration.php - Creates a user if an incoming message contents matches a pattern.
File
- modules/
sms_user/ src/ AccountRegistration.php, line 362
Class
- AccountRegistration
- Defines the account registration service.
Namespace
Drupal\sms_userCode
protected function removeAcceptableViolations(EntityConstraintViolationListInterface $violations, $incoming_form = NULL) {
// 'mail' will not fail validation if current user has 'administer users'.
$needs_email = isset($incoming_form) && strpos($incoming_form, '[email]') !== FALSE;
if (!$needs_email) {
// Invalid email field is acceptable if it is not required.
foreach ($violations as $offset => $violation) {
if ($violation
->getPropertyPath() == 'mail') {
$violations
->remove($offset);
}
}
}
return $violations;
}