mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10903 from creative-commoners/pulls/4.13/fix-multi-html-entities-in-shortcode
FIX Multi HTML entities in short codes
This commit is contained in:
commit
4f6ab330f5
@ -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