Loading core/lib/Drupal/Core/Form/ConfigFormBase.php +8 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,8 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Render\Element; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Component\Render\MarkupInterface; use Drupal\Core\Render\Markup; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -276,9 +277,10 @@ public function validateForm(array &$form, FormStateInterface $form_state) { * @param \Symfony\Component\Validator\ConstraintViolationListInterface $violations * The list of constraint violations that apply to this form element. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * @return \Drupal\Component\Render\MarkupInterface|\Stringable * The rendered HTML. */ protected function formatMultipleViolationsMessage(string $form_element_name, array $violations): TranslatableMarkup { protected function formatMultipleViolationsMessage(string $form_element_name, array $violations): MarkupInterface|\Stringable { $transformed_message_parts = []; foreach ($violations as $index => $violation) { // Note that `@validation_error_message` (should) already contain a Loading @@ -291,7 +293,9 @@ protected function formatMultipleViolationsMessage(string $form_element_name, ar '@validation_error_message' => $violation->getMessage(), ]); } return $this->t(implode("\n", $transformed_message_parts)); // We use \Drupal\Core\Render\Markup::create() here as it is safe, // rather than use t() because all input has been escaped by t(). return Markup::create(implode("\n", $transformed_message_parts)); } /** Loading Loading
core/lib/Drupal/Core/Form/ConfigFormBase.php +8 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,8 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Render\Element; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Component\Render\MarkupInterface; use Drupal\Core\Render\Markup; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -276,9 +277,10 @@ public function validateForm(array &$form, FormStateInterface $form_state) { * @param \Symfony\Component\Validator\ConstraintViolationListInterface $violations * The list of constraint violations that apply to this form element. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * @return \Drupal\Component\Render\MarkupInterface|\Stringable * The rendered HTML. */ protected function formatMultipleViolationsMessage(string $form_element_name, array $violations): TranslatableMarkup { protected function formatMultipleViolationsMessage(string $form_element_name, array $violations): MarkupInterface|\Stringable { $transformed_message_parts = []; foreach ($violations as $index => $violation) { // Note that `@validation_error_message` (should) already contain a Loading @@ -291,7 +293,9 @@ protected function formatMultipleViolationsMessage(string $form_element_name, ar '@validation_error_message' => $violation->getMessage(), ]); } return $this->t(implode("\n", $transformed_message_parts)); // We use \Drupal\Core\Render\Markup::create() here as it is safe, // rather than use t() because all input has been escaped by t(). return Markup::create(implode("\n", $transformed_message_parts)); } /** Loading