mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Multi HTML entities in shortcodes
This commit is contained in:
parent
2a56cc3ea4
commit
037168a4fe
@ -190,4 +190,14 @@ class HTMLEditorField extends TextareaField
|
||||
$stateDefaults['data'] = $config->getConfigSchemaData();
|
||||
return $stateDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value with all values encoded in html entities
|
||||
*
|
||||
* @return string Raw HTML
|
||||
*/
|
||||
public function ValueEntities()
|
||||
{
|
||||
return htmlentities($this->Value() ?? '', ENT_COMPAT, 'UTF-8', false);
|
||||
}
|
||||
}
|
||||
|
@ -208,4 +208,25 @@ EOS
|
||||
$readonlyContent->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
public function testValueEntities()
|
||||
{
|
||||
$inputText = "The company & partners";
|
||||
$field = new HTMLEditorField("Content");
|
||||
$field->setValue($inputText);
|
||||
|
||||
$this->assertEquals(
|
||||
"The company & partners",
|
||||
$field->obj('ValueEntities')->forTemplate()
|
||||
);
|
||||
|
||||
$inputText = "The company && partners";
|
||||
$field = new HTMLEditorField("Content");
|
||||
$field->setValue($inputText);
|
||||
|
||||
$this->assertEquals(
|
||||
"The company && partners",
|
||||
$field->obj('ValueEntities')->forTemplate()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user