Skip to content

Commit

Permalink
TemplateFactory: |padLeft & |padRight are native in Latte
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 19, 2017
1 parent d982968 commit 1a26321
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"nette/forms": "^2.4 || ^3.0",
"nette/robot-loader": "^2.4.2 || ^3.0",
"nette/security": "^2.4 || ^3.0",
"latte/latte": "^2.4.1",
"latte/latte": "^2.4.3",
"tracy/tracy": "^2.4",
"mockery/mockery": "^0.9.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/ApplicationLatte/TemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function createTemplate(UI\Control $control = NULL)
});

$latte->addFilter('url', 'rawurlencode'); // back compatiblity
foreach (['normalize', 'toAscii', 'webalize', 'padLeft', 'padRight', 'reverse'] as $name) {
foreach (['normalize', 'toAscii', 'webalize', 'reverse'] as $name) {
$latte->addFilter($name, 'Nette\Utils\Strings::' . $name);
}
$latte->addFilter('null', function () {});
Expand Down
2 changes: 0 additions & 2 deletions tests/Bridges.Latte/TemplateFactory.filters.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,4 @@ Assert::same('%25', $latte->invokeFilter('url', ['%']));
Assert::null($latte->invokeFilter('null', ['x']));
Assert::same('', $latte->invokeFilter('normalize', [' ']));
Assert::same('a-b', $latte->invokeFilter('webalize', ['a b']));
Assert::same(' a', $latte->invokeFilter('padLeft', ['a', 3]));
Assert::same('a ', $latte->invokeFilter('padRight', ['a', 3]));
Assert::same('cba', $latte->invokeFilter('reverse', ['abc']));

0 comments on commit 1a26321

Please sign in to comment.