Skip to content
Snippets Groups Projects
Commit 333dab91 authored by Marcin Kolanko's avatar Marcin Kolanko
Browse files

Merge branch 'bugfix/put_data_no_empty_key' into 'master'

dont save empty keys

See merge request !4
parents 537d09c4 a3d016b3
Branches
Tags 2.0.2
1 merge request!4dont save empty keys
Pipeline #4804 failed
= 1.0 - 2019-12-16 =
# Changelog
## 2.0.2 - 2020-06-17
### Changed
- Skip saving empty keys in the PersistentContainer
## 2.0.1 - 2020-06-05
### Changed
- Stable version of persistent library is used
## 2.0.0 - 2020-05-26
### Changed
- Whole library has been rewritten
## 1.0 - 2019-12-16 =
* First release
......@@ -171,6 +171,11 @@ class FormWithFields implements Form, ContainerForm, FieldProvider {
public function put_data( PersistentContainer $container ) {
foreach ( $this->get_fields() as $field ) {
$data_key = $field->get_name();
if ( empty( $data_key ) ) {
continue;
}
if ( ! isset( $this->updated_data[ $data_key ] ) ) {
$container->set( $data_key, $field->get_default_value() );
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment