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

dont save empty keys

parent 537d09c4
No related branches found
No related tags found
1 merge request!4dont save empty keys
Pipeline #4670 passed
......@@ -171,6 +171,9 @@ 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