Adds intval filter and fixes issue with number format applied on IDs
>=1000
This commit is contained in:
@@ -31,6 +31,7 @@ class Renderer {
|
|||||||
$this->setupDebug();
|
$this->setupDebug();
|
||||||
$this->setupTranslations();
|
$this->setupTranslations();
|
||||||
$this->setupFunctions();
|
$this->setupFunctions();
|
||||||
|
$this->setupFilters();
|
||||||
$this->setupHandlebars();
|
$this->setupHandlebars();
|
||||||
$this->setupHelpscout();
|
$this->setupHelpscout();
|
||||||
$this->setupGlobalVariables();
|
$this->setupGlobalVariables();
|
||||||
@@ -45,6 +46,10 @@ class Renderer {
|
|||||||
$this->renderer->addExtension(new Twig\Functions());
|
$this->renderer->addExtension(new Twig\Functions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupFilters() {
|
||||||
|
$this->renderer->addExtension(new Twig\Filters());
|
||||||
|
}
|
||||||
|
|
||||||
function setupHandlebars() {
|
function setupHandlebars() {
|
||||||
$this->renderer->addExtension(new Twig\Handlebars());
|
$this->renderer->addExtension(new Twig\Handlebars());
|
||||||
}
|
}
|
||||||
|
20
lib/Twig/Filters.php
Normal file
20
lib/Twig/Filters.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Twig;
|
||||||
|
|
||||||
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
|
class Filters extends \Twig_Extension {
|
||||||
|
|
||||||
|
function getName() {
|
||||||
|
return 'filters';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFilters() {
|
||||||
|
return array(
|
||||||
|
new \Twig_SimpleFilter(
|
||||||
|
'intval',
|
||||||
|
'intval'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1193,7 +1193,7 @@
|
|||||||
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
|
||||||
},
|
},
|
||||||
urls: {
|
urls: {
|
||||||
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ (params('id') | number_format)) %>',
|
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ (params('id') | intval)) %>',
|
||||||
imageMissing: '<%= image_url(
|
imageMissing: '<%= image_url(
|
||||||
"newsletter_editor/image-missing.svg"
|
"newsletter_editor/image-missing.svg"
|
||||||
) %>',
|
) %>',
|
||||||
@@ -1204,7 +1204,7 @@
|
|||||||
endpoint: 'newsletters',
|
endpoint: 'newsletters',
|
||||||
action: 'get',
|
action: 'get',
|
||||||
data: {
|
data: {
|
||||||
id: "<%= params('id') | number_format %>",
|
id: "<%= params('id') | intval %>",
|
||||||
}
|
}
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
MailPoet.Modal.loading(false);
|
MailPoet.Modal.loading(false);
|
||||||
|
Reference in New Issue
Block a user