function UpdateSettingsForm::formatMultipleViolationsMessage

Same name in other branches
  1. 11.x core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::formatMultipleViolationsMessage()

Overrides ConfigFormBase::formatMultipleViolationsMessage

File

core/modules/update/src/UpdateSettingsForm.php, line 93

Class

UpdateSettingsForm
Configure update settings for this site.

Namespace

Drupal\update

Code

protected function formatMultipleViolationsMessage(string $form_element_name, array $violations) : TranslatableMarkup {
    if ($form_element_name !== 'update_notify_emails') {
        return parent::formatMultipleViolationsMessage($form_element_name, $violations);
    }
    $invalid_email_addresses = [];
    foreach ($violations as $violation) {
        $invalid_email_addresses[] = $violation->getInvalidValue();
    }
    return $this->t('%emails are not valid email addresses.', [
        '%emails' => implode(', ', $invalid_email_addresses),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.