API Remove deprecated methods in EditableFormField, add upgrade guide for UF 4-5

This commit is contained in:
Robbie Averill 2017-09-19 16:04:48 +12:00
parent 5021cc4162
commit de3c8db399
3 changed files with 28 additions and 70 deletions

View File

@ -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

View File

@ -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.

24
docs/en/upgrading.md Normal file
View File

@ -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.