diff --git a/core/lib/Drupal/Component/Utility/SafeMarkup.php b/core/lib/Drupal/Component/Utility/SafeMarkup.php index 69d12fe..c54cb05 100644 --- a/core/lib/Drupal/Component/Utility/SafeMarkup.php +++ b/core/lib/Drupal/Component/Utility/SafeMarkup.php @@ -183,11 +183,15 @@ public static function getAll() { * @see drupal_validate_utf8() */ public static function checkPlain($text) { - $string = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); + $string = static::doCheckPlain($text); static::$safeStrings[$string]['html'] = TRUE; return $string; } + protected static function doCheckPlain($text) { + return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); + } + /** * Formats a string for HTML display by replacing variable placeholders. * @@ -240,13 +244,13 @@ public static function format($string, array $args = array()) { switch ($key[0]) { case '@': // Escaped only. - $args[$key] = static::escape($value); + $args[$key] = static::isSafe($value) ? $value : static::doCheckPlain($value); break; case '%': default: // Escaped and placeholder. - $args[$key] = static::placeholder($value); + $args[$key] = static::doPlaceholder($value); break; case '!': @@ -277,12 +281,21 @@ public static function format($string, array $args = array()) { * The formatted text (html). */ public static function placeholder($text) { - $string = '' . static::escape($text) . ''; + $string = static::doPlaceHolder($text); static::$safeStrings[$string]['html'] = TRUE; return $string; } /** + * @param $text + * @return string + */ + protected static function doPlaceHolder($text) { + $text = static::isSafe($text) ? $text : static::doCheckPlain($text); + return '' . $text . ''; + } + + /** * Replaces all occurrences of the search string with the replacement string. * * Functions identically to str_replace(), but marks the returned output as diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index 28529eb..7086cc8 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -290,8 +290,8 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En $title = $this->entityFormTitle($entity); // When editing the original values display just the entity label. if ($form_langcode != $entity_langcode) { - $t_args = array('%language' => $languages[$form_langcode]->getName(), '%title' => $entity->label(), '!title' => $title); - $title = empty($source_langcode) ? t('!title [%language translation]', $t_args) : t('Create %language translation of %title', $t_args); + $t_args = array('%language' => $languages[$form_langcode]->getName(), '%title' => $entity->label(), '@title' => $title); + $title = empty($source_langcode) ? t('@title [%language translation]', $t_args) : t('Create %language translation of %title', $t_args); } $form['#title'] = $title; }