Add date field settings data to store
[MAILPOET-2453]
This commit is contained in:
committed by
Rostislav Wolný
parent
080d5c84ac
commit
d3399ca883
@ -53,4 +53,7 @@ export default {
|
||||
getFormBlocks(state) {
|
||||
return state.formBlocks;
|
||||
},
|
||||
getDateSettingsData(state) {
|
||||
return state.dateSettingsData;
|
||||
},
|
||||
};
|
||||
|
@ -14,10 +14,16 @@ export default () => {
|
||||
const formData = { ...window.mailpoet_form_data };
|
||||
const formBlocks = formBodyToBlocks(formData.body, window.mailpoet_custom_fields);
|
||||
delete formData.body;
|
||||
const dateSettingData = {
|
||||
dateTypes: window.mailpoet_date_types,
|
||||
dateFormats: window.mailpoet_date_formats,
|
||||
moths: window.mailpoet_months,
|
||||
};
|
||||
formData.settings.segments = formData.settings.segments ? formData.settings.segments : [];
|
||||
const defaultState = {
|
||||
formBlocks,
|
||||
formData,
|
||||
dateSettingData,
|
||||
sidebarOpened: true,
|
||||
formExports: window.mailpoet_form_exports,
|
||||
formErrors: validateForm(formData, formBlocks),
|
||||
|
@ -66,10 +66,15 @@ class FormEditor {
|
||||
$data['form']['styles'] = FormRenderer::getStyles($form);
|
||||
$custom_fields = $this->custom_fields_repository->findAll();
|
||||
$data['custom_fields'] = $this->custom_fields_response_builder->buildBatch($custom_fields);
|
||||
$data['date_types'] = array_map(function ($label, $value) {
|
||||
return [
|
||||
'label' => $label,
|
||||
'value' => $value,
|
||||
];
|
||||
}, $data['date_types'], array_keys($data['date_types']));
|
||||
$this->page_renderer->displayPage('form/editor.html', $data);
|
||||
} else {
|
||||
$this->page_renderer->displayPage('form/editor_legacy.html', $data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user