Use underscore to unify naming
[MAILPOET-2639]
This commit is contained in:
committed by
Jack Kitterhing
parent
1c1f0313f0
commit
f001542b3e
@@ -3,8 +3,8 @@ export default function mapFormDataAfterLoading(data) {
|
||||
...data,
|
||||
settings: {
|
||||
...data.settings,
|
||||
placeFormBellowAllPages: data.settings.placeFormBellowAllPages === '1',
|
||||
placeFormBellowAllPosts: data.settings.placeFormBellowAllPosts === '1',
|
||||
placeFormBellowAllPages: data.settings.place_form_bellow_all_pages === '1',
|
||||
placeFormBellowAllPosts: data.settings.place_form_bellow_all_posts === '1',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ export default function mapFormDataBeforeSaving(data) {
|
||||
...data,
|
||||
settings: {
|
||||
...data.settings,
|
||||
placeFormBellowAllPages: data.settings.placeFormBellowAllPages === true ? '1' : '',
|
||||
placeFormBellowAllPosts: data.settings.placeFormBellowAllPosts === true ? '1' : '',
|
||||
place_form_bellow_all_pages: data.settings.placeFormBellowAllPages === true ? '1' : '',
|
||||
place_form_bellow_all_posts: data.settings.placeFormBellowAllPosts === true ? '1' : '',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@@ -72,13 +72,13 @@ class DisplayFormInWPContent {
|
||||
private function shouldDisplayFormBellowContent(FormEntity $form): bool {
|
||||
$settings = $form->getSettings();
|
||||
if (!is_array($settings)) return false;
|
||||
if (!isset($settings['placeFormBellowAllPosts'])) return false;
|
||||
if (!isset($settings['place_form_bellow_all_posts'])) return false;
|
||||
if (
|
||||
($settings['placeFormBellowAllPosts'] === '1')
|
||||
($settings['place_form_bellow_all_posts'] === '1')
|
||||
&& $this->wp->isSingular('post')
|
||||
) return true;
|
||||
if (
|
||||
($settings['placeFormBellowAllPages'] === '1')
|
||||
($settings['place_form_bellow_all_pages'] === '1')
|
||||
&& $this->wp->isPage()
|
||||
) return true;
|
||||
return false;
|
||||
|
@@ -10,8 +10,8 @@ const data = {
|
||||
success_message: 'Check your inbox or spam folder to confirm your subscription.',
|
||||
success_page: '5',
|
||||
segments_selected_by: 'admin',
|
||||
placeFormBellowAllPages: '1',
|
||||
placeFormBellowAllPosts: '',
|
||||
place_form_bellow_all_pages: '1',
|
||||
place_form_bellow_all_posts: '',
|
||||
},
|
||||
styles: 'styles definition',
|
||||
created_at: '2020-01-15 07:39:15',
|
||||
|
@@ -55,8 +55,8 @@ describe('Form Data Save Mapper', () => {
|
||||
});
|
||||
|
||||
it('maps placement', () => {
|
||||
expect(map(data).settings).to.have.property('placeFormBellowAllPages', '1');
|
||||
expect(map(data).settings).to.have.property('placeFormBellowAllPosts', '');
|
||||
expect(map(data).settings).to.have.property('place_form_bellow_all_pages', '1');
|
||||
expect(map(data).settings).to.have.property('place_form_bellow_all_posts', '');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -34,8 +34,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form = new FormEntity('My Form');
|
||||
$form->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '',
|
||||
'placeFormBellowAllPosts' => '1',
|
||||
'place_form_bellow_all_pages' => '',
|
||||
'place_form_bellow_all_posts' => '1',
|
||||
]);
|
||||
$form->setBody([[
|
||||
'type' => 'submit',
|
||||
@@ -57,8 +57,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form = new FormEntity('My Form');
|
||||
$form->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '',
|
||||
'placeFormBellowAllPosts' => '',
|
||||
'place_form_bellow_all_pages' => '',
|
||||
'place_form_bellow_all_posts' => '',
|
||||
]);
|
||||
$form->setBody([[
|
||||
'type' => 'submit',
|
||||
@@ -78,8 +78,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form1 = new FormEntity('My Form');
|
||||
$form1->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '',
|
||||
'placeFormBellowAllPosts' => '1',
|
||||
'place_form_bellow_all_pages' => '',
|
||||
'place_form_bellow_all_posts' => '1',
|
||||
]);
|
||||
$form1->setBody([[
|
||||
'type' => 'submit',
|
||||
@@ -90,8 +90,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form2 = new FormEntity('My Form');
|
||||
$form2->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '',
|
||||
'placeFormBellowAllPosts' => '1',
|
||||
'place_form_bellow_all_pages' => '',
|
||||
'place_form_bellow_all_posts' => '1',
|
||||
]);
|
||||
$form2->setBody([[
|
||||
'type' => 'submit',
|
||||
@@ -121,8 +121,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form = new FormEntity('My Form');
|
||||
$form->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '',
|
||||
'placeFormBellowAllPosts' => '1',
|
||||
'place_form_bellow_all_pages' => '',
|
||||
'place_form_bellow_all_posts' => '1',
|
||||
]);
|
||||
$form->setBody([[
|
||||
'type' => 'submit',
|
||||
@@ -145,8 +145,8 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
|
||||
$form = new FormEntity('My Form');
|
||||
$form->setSettings([
|
||||
'segments' => ['3'],
|
||||
'placeFormBellowAllPages' => '1',
|
||||
'placeFormBellowAllPosts' => '',
|
||||
'place_form_bellow_all_pages' => '1',
|
||||
'place_form_bellow_all_posts' => '',
|
||||
]);
|
||||
$form->setBody([[
|
||||
'type' => 'submit',
|
||||
|
Reference in New Issue
Block a user