- Updates menu/editor view to work with the refactored shortcodes logic
This commit is contained in:
@@ -7,6 +7,7 @@ use MailPoet\Models\CustomField;
|
|||||||
use MailPoet\Models\Form;
|
use MailPoet\Models\Form;
|
||||||
use MailPoet\Models\Segment;
|
use MailPoet\Models\Segment;
|
||||||
use MailPoet\Models\Setting;
|
use MailPoet\Models\Setting;
|
||||||
|
use MailPoet\Newsletter\Shortcodes\ShortcodesHelper;
|
||||||
use MailPoet\Settings\Charsets;
|
use MailPoet\Settings\Charsets;
|
||||||
use MailPoet\Settings\Hosts;
|
use MailPoet\Settings\Hosts;
|
||||||
use MailPoet\Settings\Pages;
|
use MailPoet\Settings\Pages;
|
||||||
@@ -419,15 +420,8 @@ class Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newletterEditor() {
|
function newletterEditor() {
|
||||||
$custom_fields = array_map(function($field) {
|
|
||||||
return array(
|
|
||||||
'text' => $field['name'],
|
|
||||||
'shortcode' => 'field:' . $field['id'],
|
|
||||||
);
|
|
||||||
}, CustomField::findArray());
|
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'customFields' => $custom_fields,
|
'shortcodes' => ShortcodesHelper::getShortcodes(),
|
||||||
'settings' => Setting::getAll(),
|
'settings' => Setting::getAll(),
|
||||||
'sub_menu' => 'mailpoet-newsletters'
|
'sub_menu' => 'mailpoet-newsletters'
|
||||||
);
|
);
|
||||||
|
@@ -1168,93 +1168,7 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
customFields: {
|
shortcodes: <%= json_encode(shortcodes) %>,
|
||||||
'<%= __('Subscriber') %>': [
|
|
||||||
{
|
|
||||||
text: '<%= __('First Name') %>',
|
|
||||||
shortcode: 'user:firstname | default:reader',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Last Name') %>',
|
|
||||||
shortcode: 'user:lastname | default:reader',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Email Address') %>',
|
|
||||||
shortcode: 'user:email',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Wordpress user display name') %>',
|
|
||||||
shortcode: 'user:displayname | default:member',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Total of subscribers') %>',
|
|
||||||
shortcode: 'user:count',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'<%= __('Newsletter') %>': [
|
|
||||||
{
|
|
||||||
text: '<%= __('Newsletter Subject') %>',
|
|
||||||
shortcode: 'newsletter:subject',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'<%= __('Post Notifications') %>': [
|
|
||||||
{
|
|
||||||
text: '<%= __('Total number of posts or pages') %>',
|
|
||||||
shortcode: 'newsletter:total',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Latest post title') %>',
|
|
||||||
shortcode: 'newsletter:post_title',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Issue number') %>',
|
|
||||||
shortcode: 'newsletter:number',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'<%= __('Date') %>': [
|
|
||||||
{
|
|
||||||
text: '<%= __('Current day of the month number') %>',
|
|
||||||
shortcode: 'date:d',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Current day of the month in ordinal, ie. 2nd, 3rd, etc.') %>',
|
|
||||||
shortcode: 'date:dordinal',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Full name of current day') %>',
|
|
||||||
shortcode: 'date:dtext',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Current month number') %>',
|
|
||||||
shortcode: 'date:m',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Full name of current month') %>',
|
|
||||||
shortcode: 'date:mtext',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Year') %>',
|
|
||||||
shortcode: 'date:y',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'<%= __('Links') %>': [
|
|
||||||
{
|
|
||||||
text: '<%= __('Unsubscribe link') %>',
|
|
||||||
shortcode: 'link:subscription_unsubscribe',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('Edit subscription page link') %>',
|
|
||||||
shortcode: 'link:subscription_manage',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '<%= __('View in browser link') %>',
|
|
||||||
shortcode: 'link:newsletter_view_in_browser',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
<% if customFields %>
|
|
||||||
'<%= __('Custom fields') %>': <%= json_encode(customFields) %>,
|
|
||||||
<% endif %>
|
|
||||||
},
|
|
||||||
sidepanelWidth: '331px',
|
sidepanelWidth: '331px',
|
||||||
validation: {
|
validation: {
|
||||||
validateUnsubscribeLinkPresent: true, // TODO: Add validation based on whether Mailpoet MTA is used or not
|
validateUnsubscribeLinkPresent: true, // TODO: Add validation based on whether Mailpoet MTA is used or not
|
||||||
|
Reference in New Issue
Block a user