reverted: --- b/core/modules/taxonomy/src/Controller/TermAutocompleteController.php +++ a/core/modules/taxonomy/src/Controller/TermAutocompleteController.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\Tags; use Drupal\Component\Utility\Unicode; +use Drupal\Component\Utility\String; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\Query\QueryInterface; @@ -161,7 +161,7 @@ foreach ($terms as $term) { // Term names containing commas or quotes must be wrapped in quotes. $name = Tags::encode($term->getName()); + $matches[] = array('value' => $prefix . $name, 'label' => String::checkPlain($term->getName())); - $matches[] = array('value' => $prefix . $name, 'label' => SafeMarkup::checkPlain($term->getName())); } return $matches; } reverted: --- b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy\Plugin\Field\FieldFormatter; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Component\Utility\String; -use Drupal\Component\Utility\SafeMarkup; use Drupal\taxonomy\Plugin\Field\FieldType\TaxonomyTermReferenceItem; /** @@ -34,7 +34,7 @@ foreach ($items as $delta => $item) { if ($item->hasNewEntity()) { $elements[$delta] = array( + '#markup' => String::checkPlain($item->entity->label()), - '#markup' => SafeMarkup::checkPlain($item->entity->label()), ); } else { reverted: --- b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/PlainFormatter.php +++ a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/PlainFormatter.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy\Plugin\Field\FieldFormatter; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Component\Utility\String; -use Drupal\Component\Utility\SafeMarkup; /** * Plugin implementation of the 'taxonomy_term_reference_plain' formatter. @@ -31,7 +31,7 @@ foreach ($items as $delta => $item) { $elements[$delta] = array( + '#markup' => String::checkPlain($item->entity->label()), - '#markup' => SafeMarkup::checkPlain($item->entity->label()), ); } reverted: --- b/core/modules/taxonomy/src/Tests/TermTest.php +++ a/core/modules/taxonomy/src/Tests/TermTest.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy\Tests; use Drupal\Component\Serialization\Json; +use Drupal\Component\Utility\String; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Tags; use Drupal\Component\Utility\Unicode; use Drupal\Core\Field\FieldStorageDefinitionInterface; @@ -342,8 +342,8 @@ return $item['label']; }, $data); + $this->assertTrue(in_array(String::checkPlain($first_term->getName()), $data), 'Autocomplete returned the first matching term'); + $this->assertTrue(in_array(String::checkPlain($second_term->getName()), $data), 'Autocomplete returned the second matching term'); - $this->assertTrue(in_array(SafeMarkup::checkPlain($first_term->getName()), $data), 'Autocomplete returned the first matching term'); - $this->assertTrue(in_array(SafeMarkup::checkPlain($second_term->getName()), $data), 'Autocomplete returned the second matching term'); // Try to autocomplete a term name that matches first term. // We should only get the first term in a json encoded string. @@ -351,7 +351,7 @@ $path = 'taxonomy/autocomplete/node/taxonomy_' . $this->vocabulary->id(); $this->drupalGet($path, array('query' => array('q' => $input))); $target = array(array( + 'value' => String::checkPlain($first_term->getName()), - 'value' => SafeMarkup::checkPlain($first_term->getName()), 'label' => $first_term->getName(), )); $this->assertRaw(Json::encode($target), 'Autocomplete returns only the expected matching term.'); @@ -364,7 +364,7 @@ $n = Tags::encode($third_term->getName()); $target = array(array( 'value' => $n, + 'label' => String::checkPlain($third_term->getName()), - 'label' => SafeMarkup::checkPlain($third_term->getName()), )); $this->assertRaw(Json::encode($target), 'Autocomplete returns a term containing a comma and a slash.'); }