Commit bfb0580c authored by alexpott's avatar alexpott

Issue #2532284 by sasanikolic, joelpittet, cilefen, miro_dietiker: HTML is...

Issue #2532284 by sasanikolic, joelpittet, cilefen, miro_dietiker: HTML is escaped in "all languages" in UI after SafeMarkup change
parent c65d6df7
......@@ -206,7 +206,10 @@ function template_preprocess_fieldset(&$variables) {
$variables['children'] = $element['#children'];
$variables['required'] = !empty($element['#required']) ? $element['#required'] : NULL;
$variables['legend']['title'] = (isset($element['#title']) && $element['#title'] !== '') ? Xss::filterAdmin($element['#title']) : '';
if (isset($element['#title']) && $element['#title'] !== '') {
$variables['legend']['title'] = ['#markup' => $element['#title']];
}
$variables['legend']['attributes'] = new Attribute();
$variables['legend_span']['attributes'] = new Attribute();
......@@ -504,7 +507,10 @@ function template_preprocess_form_element(&$variables) {
function template_preprocess_form_element_label(&$variables) {
$element = $variables['element'];
// If title and required marker are both empty, output no label.
$variables['title'] = (isset($element['#title']) && $element['#title'] !== '') ? Xss::filterAdmin($element['#title']) : '';
if (isset($element['#title']) && $element['#title'] !== '') {
$variables['title'] = ['#markup' => $element['#title']];
}
$variables['attributes'] = array();
// Pass elements title_display to template.
......
......@@ -14,6 +14,11 @@
*/
class ContentTestTranslationUITest extends ContentTranslationUITestBase {
/**
* {@inheritdoc}
*/
protected $testHTMLEscapeForAllLanguages = TRUE;
/**
* Modules to enable.
*
......
......@@ -37,6 +37,14 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
*/
protected $testLanguageSelector = TRUE;
/**
* Flag that tells whether the HTML escaping of all languages works or not
* after SafeMarkup change.
*
* @var bool
*/
protected $testHTMLEscapeForAllLanguages = FALSE;
/**
* Default cache contexts expected on a non-translated entity.
*
......@@ -105,6 +113,13 @@ protected function doTestBasicTranslation() {
], array('language' => $language));
$this->drupalPostForm($add_url, $this->getEditValues($values, $langcode), $this->getFormSubmitActionForNewTranslation($entity, $langcode));
// Assert that HTML is escaped in "all languages" in UI after SafeMarkup
// change.
if ($this->testHTMLEscapeForAllLanguages) {
$this->assertNoRaw('<span class="translation-entity-all-languages">(all languages)</span>');
$this->assertRaw('<span class="translation-entity-all-languages">(all languages)</span>');
}
// Ensure that the content language cache context is not yet added to the
// page.
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment