From de3c8db39942e99fd2d6256bbf3dc4f639251b54 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 19 Sep 2017 16:04:48 +1200 Subject: [PATCH] API Remove deprecated methods in EditableFormField, add upgrade guide for UF 4-5 --- code/Model/EditableFormField.php | 67 -------------------------------- docs/en/index.md | 7 ++-- docs/en/upgrading.md | 24 ++++++++++++ 3 files changed, 28 insertions(+), 70 deletions(-) create mode 100644 docs/en/upgrading.md diff --git a/code/Model/EditableFormField.php b/code/Model/EditableFormField.php index 91b7cdd..41fe13e 100755 --- a/code/Model/EditableFormField.php +++ b/code/Model/EditableFormField.php @@ -9,7 +9,6 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use SilverStripe\Core\Manifest\ModuleLoader; -use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FieldList; @@ -567,36 +566,6 @@ class EditableFormField extends DataObject return stripos($this->ID, 'new') === 0; } - /** - * @deprecated since version 4.0 - */ - public function getSettings() - { - Deprecation::notice('4.0', 'getSettings is deprecated'); - return (!empty($this->CustomSettings)) ? unserialize($this->CustomSettings) : array(); - } - - /** - * @deprecated since version 4.0 - */ - public function setSettings($settings = array()) - { - Deprecation::notice('4.0', 'setSettings is deprecated'); - $this->CustomSettings = serialize($settings); - } - - /** - * @deprecated since version 4.0 - */ - public function setSetting($key, $value) - { - Deprecation::notice('4.0', "setSetting({$key}) is deprecated"); - $settings = $this->getSettings(); - $settings[$key] = $value; - - $this->setSettings($settings); - } - /** * Set the allowed css classes for the extraClass custom setting * @@ -611,22 +580,6 @@ class EditableFormField extends DataObject } } - /** - * @deprecated since version 4.0 - */ - public function getSetting($setting) - { - Deprecation::notice("4.0", "getSetting({$setting}) is deprecated"); - - $settings = $this->getSettings(); - if (isset($settings) && count($settings) > 0) { - if (isset($settings[$setting])) { - return $settings[$setting]; - } - } - return ''; - } - /** * Get the path to the icon for this field type, relative to the site root. * @@ -715,26 +668,6 @@ class EditableFormField extends DataObject return $this->i18n_singular_name() . ' (' . $this->Title . ')'; } - /** - * @deprecated since version 4.0 - */ - public function getFieldName($field = false) - { - Deprecation::notice('4.0', "getFieldName({$field}) is deprecated"); - return ($field) ? "Fields[".$this->ID."][".$field."]" : "Fields[".$this->ID."]"; - } - - /** - * @deprecated since version 4.0 - */ - public function getSettingName($field) - { - Deprecation::notice('4.0', "getSettingName({$field}) is deprecated"); - $name = $this->getFieldName('CustomSettings'); - - return $name . '[' . $field .']'; - } - /** * Append custom validation fields to the default 'Validation' * section in the editable options view diff --git a/docs/en/index.md b/docs/en/index.md index ebd22da..6591b00 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -1,6 +1,6 @@ # UserForms -UserForms enables CMS users to create dynamic forms via a drag and drop interface +UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code. ## Maintainer Contact @@ -28,11 +28,12 @@ See the "require" section of [composer.json](https://github.com/silverstripe/sil * [Troubleshooting](troubleshooting) * [User Documentation](userguide/index.md) * [Compiling Front-End Files](compiling-front-end-files.md) + * [Upgrading to SilverStripe 4](upgrading.md) ## Thanks -I would like to thank everyone who has contributed to the module, bugfixers, +I would like to thank everyone who has contributed to the module, bugfixers, testers, clients who use the module and everyone that submits new features. -A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing +A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing the custom icon set for the form fields. diff --git a/docs/en/upgrading.md b/docs/en/upgrading.md new file mode 100644 index 0000000..fce68bc --- /dev/null +++ b/docs/en/upgrading.md @@ -0,0 +1,24 @@ +# Upgrading to SilverStripe 4 + +## API changes + +The SilverStripe 4 compatible version of UserForms (5.x) introduces some breaking API changes: + +* Namespaces are added. Please use the SilverStripe upgrader to automatically update references in your code. +* Previously deprecated code from UserForms 4.x has been removed: + * `EditableFormField::getSettings()` + * `EditableFormField::setSettings()` + * `EditableFormField::setSetting()` + * `EditableFormField::getSetting()` + * `EditableFormField::getFieldName()` + * `EditableFormField::getSettingName()` + +The frontend JavaScript and SASS assets have been converted from Compass to +[Webpack](https://github.com/silverstripe/webpack-config), and now live in the `client/` folder. Please +[see here](https://docs.silverstripe.org/en/4/contributing/build_tooling/) for information on this build toolchain. + +## Data migration + +UserForms 5.0 includes a legacy class name remapping configuration file (legacy.yml) as well as `$table_name` +configuration for every DataObject to ensure that existing data in your database will remain unchanged. This +should help to ensure that your upgrade process from UserForms 4.x on SilverStripe 3 is as seamless as possible.