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->setupTranslations();
|
||||
$this->setupFunctions();
|
||||
$this->setupFilters();
|
||||
$this->setupHandlebars();
|
||||
$this->setupHelpscout();
|
||||
$this->setupGlobalVariables();
|
||||
@@ -45,6 +46,10 @@ class Renderer {
|
||||
$this->renderer->addExtension(new Twig\Functions());
|
||||
}
|
||||
|
||||
function setupFilters() {
|
||||
$this->renderer->addExtension(new Twig\Filters());
|
||||
}
|
||||
|
||||
function setupHandlebars() {
|
||||
$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
|
||||
},
|
||||
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(
|
||||
"newsletter_editor/image-missing.svg"
|
||||
) %>',
|
||||
@@ -1204,7 +1204,7 @@
|
||||
endpoint: 'newsletters',
|
||||
action: 'get',
|
||||
data: {
|
||||
id: "<%= params('id') | number_format %>",
|
||||
id: "<%= params('id') | intval %>",
|
||||
}
|
||||
}).always(function() {
|
||||
MailPoet.Modal.loading(false);
|
||||
|
Reference in New Issue
Block a user