Skip to content

Commit ce4976b

Browse files
committed
Template: passes the template to the latte instead of just parameters.
Automatically will register methods as latte custom functions
1 parent 8e74483 commit ce4976b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"conflict": {
4040
"nette/di": "<3.0-stable",
4141
"nette/forms": "<3.0",
42-
"latte/latte": "<2.6",
42+
"latte/latte": "<2.7.1",
4343
"tracy/tracy": "<2.5"
4444
},
4545
"autoload": {

src/Bridges/ApplicationLatte/Template.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ final public function getLatte(): Latte\Engine
4242
*/
4343
public function render(string $file = null, array $params = []): void
4444
{
45-
$this->latte->render($file ?: $this->file, $params + $this->getParameters());
45+
Nette\Utils\Arrays::toObject($params, $this);
46+
$this->latte->render($file ?: $this->file, $this);
4647
}
4748

4849

@@ -51,7 +52,8 @@ public function render(string $file = null, array $params = []): void
5152
*/
5253
public function renderToString(string $file = null, array $params = []): string
5354
{
54-
return $this->latte->renderToString($file ?: $this->file, $params + $this->getParameters());
55+
Nette\Utils\Arrays::toObject($params, $this);
56+
return $this->latte->renderToString($file ?: $this->file, $this);
5557
}
5658

5759

0 commit comments

Comments
 (0)