Add sanitization for missing label to mapper

[MAILPOET-2592]
This commit is contained in:
Rostislav Wolny
2020-01-07 10:14:52 +01:00
committed by Rostislav Wolný
parent 2a70a7cf2f
commit 8806e4e8f8
2 changed files with 12 additions and 2 deletions

View File

@@ -78,8 +78,8 @@ export default (data, customFields = []) => {
if (item.params && has(item.params, 'label_within')) {
mapped.attributes.labelWithinInput = !!item.params.label_within;
}
if (item.params && has(item.params, 'label')) {
mapped.attributes.label = item.params.label;
if (item.params) {
mapped.attributes.label = item.params.label ? item.params.label : null;
}
switch (item.id) {
case 'email':
@@ -121,11 +121,13 @@ export default (data, customFields = []) => {
name: 'mailpoet-form/submit-button',
};
case 'divider':
delete mapped.attributes.label;
return {
...mapped,
name: 'mailpoet-form/divider',
};
case 'html':
delete mapped.attributes.label;
return {
...mapped,
name: 'mailpoet-form/html',