Copy form colour to the popup background
[MAILPOET-2741]
This commit is contained in:
@@ -37,7 +37,10 @@ jQuery(($) => {
|
|||||||
$(() => {
|
$(() => {
|
||||||
$('div.mailpoet_form_popup').each((index, element) => {
|
$('div.mailpoet_form_popup').each((index, element) => {
|
||||||
const formDiv = $(element);
|
const formDiv = $(element);
|
||||||
let delay = formDiv.find('form').data('delay');
|
const form = formDiv.find('form');
|
||||||
|
const background = form.data('background-color');
|
||||||
|
formDiv.css('background-color', background || 'white');
|
||||||
|
let delay = form.data('delay');
|
||||||
delay = parseInt(delay, 10);
|
delay = parseInt(delay, 10);
|
||||||
if (Number.isNaN(delay)) {
|
if (Number.isNaN(delay)) {
|
||||||
delay = 0;
|
delay = 0;
|
||||||
@@ -46,6 +49,7 @@ jQuery(($) => {
|
|||||||
formDiv.addClass('active');
|
formDiv.addClass('active');
|
||||||
}, delay * 1000);
|
}, delay * 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
// setup form validation
|
// setup form validation
|
||||||
$('form.mailpoet_form').each((index, element) => {
|
$('form.mailpoet_form').each((index, element) => {
|
||||||
const form = $(element);
|
const form = $(element);
|
||||||
|
@@ -124,6 +124,7 @@ class DisplayFormInWPContent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$templateData['delay'] = $formSettings['popup_form_delay'] ?? 0;
|
$templateData['delay'] = $formSettings['popup_form_delay'] ?? 0;
|
||||||
|
$templateData['backgroundColor'] = $formSettings['backgroundColor'] ?? '';
|
||||||
|
|
||||||
// generate security token
|
// generate security token
|
||||||
$templateData['token'] = Security::generateToken();
|
$templateData['token'] = Security::generateToken();
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
novalidate
|
novalidate
|
||||||
style="<%= form_element_styles %>"/* paragraphs (label + input)
|
style="<%= form_element_styles %>"/* paragraphs (label + input)
|
||||||
data-delay="<%= delay %>"
|
data-delay="<%= delay %>"
|
||||||
|
data-background-color="<%= backgroundColor %>"
|
||||||
>
|
>
|
||||||
<input type="hidden" name="data[form_id]" value="<%= form_id %>" />
|
<input type="hidden" name="data[form_id]" value="<%= form_id %>" />
|
||||||
<input type="hidden" name="token" value="<%= token %>" />
|
<input type="hidden" name="token" value="<%= token %>" />
|
||||||
|
Reference in New Issue
Block a user