Rename a 'method' field in a form widget so it doesn't break the WP interactive customizer [MAILPOET-851]
This commit is contained in:
@ -64,9 +64,13 @@ class API {
|
|||||||
$this->_endpoint = isset($data['endpoint'])
|
$this->_endpoint = isset($data['endpoint'])
|
||||||
? Helpers::underscoreToCamelCase(trim($data['endpoint']))
|
? Helpers::underscoreToCamelCase(trim($data['endpoint']))
|
||||||
: null;
|
: null;
|
||||||
$this->_method = isset($data['method'])
|
|
||||||
? Helpers::underscoreToCamelCase(trim($data['method']))
|
// JS part of /wp-admin/customize.php does not like a 'method' field in a form widget
|
||||||
|
$method_param_name = isset($data['mailpoet_method']) ? 'mailpoet_method' : 'method';
|
||||||
|
$this->_method = isset($data[$method_param_name])
|
||||||
|
? Helpers::underscoreToCamelCase(trim($data[$method_param_name]))
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
$this->_token = isset($data['token'])
|
$this->_token = isset($data['token'])
|
||||||
? trim($data['token'])
|
? trim($data['token'])
|
||||||
: null;
|
: null;
|
||||||
@ -100,6 +104,7 @@ class API {
|
|||||||
'token',
|
'token',
|
||||||
'endpoint',
|
'endpoint',
|
||||||
'method',
|
'method',
|
||||||
|
'mailpoet_method', // alias of 'method'
|
||||||
'mailpoet_redirect'
|
'mailpoet_redirect'
|
||||||
);
|
);
|
||||||
$this->_data = array_diff_key(
|
$this->_data = array_diff_key(
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<input type="hidden" name="form_id" value="<%= form.id %>" />
|
<input type="hidden" name="form_id" value="<%= form.id %>" />
|
||||||
<input type="hidden" name="token" value="<%= token %>" />
|
<input type="hidden" name="token" value="<%= token %>" />
|
||||||
<input type="hidden" name="endpoint" value="subscribers" />
|
<input type="hidden" name="endpoint" value="subscribers" />
|
||||||
<input type="hidden" name="method" value="subscribe" />
|
<input type="hidden" name="mailpoet_method" value="subscribe" />
|
||||||
|
|
||||||
<%= html | raw %>
|
<%= html | raw %>
|
||||||
<div class="mailpoet_message">
|
<div class="mailpoet_message">
|
||||||
|
Reference in New Issue
Block a user