diff --git a/docs/en/04_Changelogs/rc/3.1.10-rc1.md b/docs/en/04_Changelogs/rc/3.1.10-rc1.md new file mode 100644 index 000000000..1bfcd1c01 --- /dev/null +++ b/docs/en/04_Changelogs/rc/3.1.10-rc1.md @@ -0,0 +1,15 @@ +# 3.1.10-rc1 + +## Upgrading + +### Form Actions + +Form action titles are now safely XML encoded, although this was an implicit assumption, it is now explicitly enforced. +XML encoding titles will not cause an error, but is deprecated at framework 4.0. FormAction buttons with custom HTML +content should be assigned using the `FormAction::setButtonContent` method instead. + +## Changelog + + * [framework](https://github.com/silverstripe/silverstripe-framework/releases/tag/3.1.10-rc1) + * [cms](https://github.com/silverstripe/silverstripe-cms/releases/tag/3.1.10-rc1) + * [installer](https://github.com/silverstripe/silverstripe-installer/releases/tag/3.1.10-rc1) diff --git a/forms/FormAction.php b/forms/FormAction.php index 32c79cd3f..d9ddeb7e0 100644 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -17,31 +17,47 @@ */ class FormAction extends FormField { + /** + * Action name, normally prefixed with 'action_' + * + * @var string + */ protected $action; /** * Enables the use of <% else %> diff --git a/templates/forms/TreeDropdownField.ss b/templates/forms/TreeDropdownField.ss index 8b37d2f2b..e5d2345b2 100644 --- a/templates/forms/TreeDropdownField.ss +++ b/templates/forms/TreeDropdownField.ss @@ -1,6 +1,6 @@
title="$Description.ATT"<% end_if %> <% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %>> diff --git a/tests/model/DataDifferencerTest.php b/tests/model/DataDifferencerTest.php index b0c20bb01..e1e0d87a0 100644 --- a/tests/model/DataDifferencerTest.php +++ b/tests/model/DataDifferencerTest.php @@ -17,7 +17,7 @@ class DataDifferencerTest extends SapphireTest { public function testArrayValues() { $obj1 = $this->objFromFixture('DataDifferencerTest_Object', 'obj1'); // create a new version - $obj1->Choices = array('a'); + $obj1->Choices = 'a'; $obj1->write(); $obj1v1 = Versioned::get_version('DataDifferencerTest_Object', $obj1->ID, $obj1->Version-1); $obj1v2 = Versioned::get_version('DataDifferencerTest_Object', $obj1->ID, $obj1->Version); @@ -88,14 +88,6 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly { return $fields; } - public function getChoices() { - return explode(',', $this->getField('Choices')); - } - - public function setChoices($val) { - $this->setField('Choices', (is_array($val)) ? implode(',', $val) : $val); - } - } class DataDifferencerTest_HasOneRelationObject extends DataObject implements TestOnly { diff --git a/view/ViewableData.php b/view/ViewableData.php index 7a6cf5b4c..fb1584ddb 100644 --- a/view/ViewableData.php +++ b/view/ViewableData.php @@ -273,13 +273,11 @@ class ViewableData extends Object implements IteratorAggregate { * @return string 'xml'|'raw' */ public function escapeTypeForField($field) { - if(!$class = $this->castingClass($field)) { - $class = self::$default_cast; - } - + $class = $this->castingClass($field) ?: $this->config()->default_cast; + return Config::inst()->get($class, 'escape_type', Config::FIRST_SET); } - + /** * Save the casting cache for this object (including data from any failovers) into a variable * @@ -367,7 +365,7 @@ class ViewableData extends Object implements IteratorAggregate { if(!is_object($value) && ($this->castingClass($fieldName) || $forceReturnedObject)) { if(!$castConstructor = $this->castingHelper($fieldName)) { - $castConstructor = $this->stat('default_cast'); + $castConstructor = $this->config()->default_cast; } $valueObject = Object::create_from_string($castConstructor, $fieldName); @@ -382,7 +380,7 @@ class ViewableData extends Object implements IteratorAggregate { } if(!is_object($value) && $forceReturnedObject) { - $default = Config::inst()->get('ViewableData', 'default_cast', Config::FIRST_SET); + $default = $this->config()->default_cast; $castedValue = new $default($fieldName); $castedValue->setValue($value); $value = $castedValue;