Skip to content

Commit f6e5a09

Browse files
fprochazkadg
authored andcommitted
Template: added __call() for BC [Closes #38]
1 parent 2c5302a commit f6e5a09

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

‎src/Bridges/ApplicationLatte/Template.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ public function getParameters()
198198
}
199199

200200

201+
/**
202+
* @deprecated
203+
*/
204+
public function __call($name, $args)
205+
{
206+
return $this->latte->invokeFilter($name, $args);
207+
}
208+
209+
201210
/**
202211
* Sets a template parameter. Do not call directly.
203212
* @return void
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/**
4+
* Test: Template filters
5+
*/
6+
7+
use Nette\Bridges\ApplicationLatte\Template,
8+
Tester\Assert;
9+
10+
11+
require __DIR__ . '/../bootstrap.php';
12+
13+
$engine = new Latte\Engine;
14+
$template = new Template($engine);
15+
16+
Assert::exception(function () use ($template) {
17+
$template->length('abc');
18+
}, 'LogicException', "Filter 'length' is not defined.");
19+
20+
$engine->addFilter('length', 'strlen');
21+
22+
Assert::same( 3, $template->length('abc') );

0 commit comments

Comments
 (0)