diff --git a/docs/en/04_Changelogs/4.7.0.md b/docs/en/04_Changelogs/4.7.0.md index c2a6b6df5..0e228e27b 100644 --- a/docs/en/04_Changelogs/4.7.0.md +++ b/docs/en/04_Changelogs/4.7.0.md @@ -7,6 +7,8 @@ - [Default MySQL collation updated](#default-mysql-collation-updated) - [MySQL connection mode configurable](#mysql-connection-mode-now-configurable) - [Flysystem dependency shifted](#flysystem-dependency-shifted) +- [Improved Toast notifications](#improved-toast-notifications) +- [DataObject constructor support for hydration](#dataobject-constructor-support-for-hydration) ## New features @@ -76,3 +78,25 @@ An edgecase exists where a project can update to `silverstripe/framework 4.7.0` `silverstripe/assets 1.6.x`, and lose the Flysystem dependency entirely. The best way to avoid this is by ensuring you update all core modules to the new minor release at once, ideally through a core recipe like `silverstripe/recipe-core`. + +### Improved Toast notifications + +Toast notifications have been completely revamped +- Toast notifications can now be triggered from React components using Redux actions +- Actions can now be attached to the toast notifications +- Accessibility has been improved (see the component documentation for caveats when using actions) + +Asset-admin has been updated to use toast notifications instead of alerts. More modules will start +using them in future releases. + +[Review the Toast story in the pattern library](https://silverstripe.github.io/silverstripe-admin/?selectedKind=Admin%2FToasts&selectedStory=Single) +to learn how and when to use the toast notifications. + +### DataObject constructor support for hydration + +Many developers wrongly assumed that the DataObject constructor could be used to "hydrate" a record +by passing an array of value to it. While this worked in some cases, values would be run through +setters and validation occasionally leading to inconsistencies. + +Silverstripe CMS Recipe 4.7 introduces improvements to the DataObject constructor to provide proper +support for hydration. diff --git a/docs/en/04_Changelogs/beta/4.7.0-beta1.md b/docs/en/04_Changelogs/beta/4.7.0-beta1.md index 6a272b3cf..dde4d264a 100644 --- a/docs/en/04_Changelogs/beta/4.7.0-beta1.md +++ b/docs/en/04_Changelogs/beta/4.7.0-beta1.md @@ -7,6 +7,8 @@ - [Default MySQL collation updated](#default-mysql-collation-updated) - [MySQL connection mode configurable](#mysql-connection-mode-now-configurable) - [Flysystem dependency shifted](#flysystem-dependency-shifted) +- [Improved Toast notifications](#improved-toast-notifications) +- [DataObject constructor support for hydration](#dataobject-constructor-support-for-hydration) ## New features @@ -77,6 +79,43 @@ An edgecase exists where a project can update to `silverstripe/framework 4.7.0` is by ensuring you update all core modules to the new minor release at once, ideally through a core recipe like `silverstripe/recipe-core`. +### Improved Toast notifications + +Toast notifications have been completely revamped +- Toast notifications can now be triggered from React components using Redux actions +- Actions can now be attached to the toast notifications +- Accessibility has been improved (see the component documentation for caveats when using actions) + +Asset-admin has been updated to use toast notifications instead of alerts. More modules will start +using them in future releases. + +[Review the Toast story in the pattern library](https://silverstripe.github.io/silverstripe-admin/?selectedKind=Admin%2FToasts&selectedStory=Single) +to learn how and when to use the toast notifications. + +### DataObject constructor support for hydration + +Many developers wrongly assumed that the DataObject constructor could be used to "hydrate" a record +by passing an array of value to it. While this worked in some cases, values would be run through +setters and validation occasionally leading to inconsistencies. + +Silverstripe CMS Recipe 4.7 introduces improvements to the DataObject constructor to provide proper +support for hydration. + +```php +// Default behavior. Setters and validation will be applied to the provided data. +// Equivalent to `Foo::create(['Title' => 'Bar'])` +$newFoo = Foo::create(['Title' => 'Bar'], DataObject::CREATE_OBJECT); + +// Creates a "singleton" instance. The provided data will be ignored. +// Equivalent to `Foo::singleton()` +$newFoo = Foo::create(['Title' => 'Bar'], DataObject::CREATE_SINGLETON); + +// Hydrate the record with data manually retrieved from the database. The provided +// data is stored directly in the DataObject without going through setters or validation. +// This was not possible prior to the the 4.7 release. +$newFoo = Foo::create(['Title' => 'Bar', 'ID' => 123], DataObject::CREATE_HYDRATED); +``` + ## Change Log ### API Changes