Verified Commit b0143182 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3456149 by pooja_sharma, smustgrave, quietone, catch, alexpott: Fix...

Issue #3456149 by pooja_sharma, smustgrave, quietone, catch, alexpott: Fix translation string in ConfigFormBase.php
parent a6f5d7d3
Loading
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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;

@@ -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
@@ -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));
  }

  /**