Skip to content

Commit

Permalink
Template: passes the template to the latte instead of just parameters.
Browse files Browse the repository at this point in the history
Automatically will register methods as latte custom functions
  • Loading branch information
dg committed Apr 2, 2020
1 parent 194891c commit 2fd8987
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"conflict": {
"nette/di": "<3.0-stable",
"nette/forms": "<3.0",
"latte/latte": "<2.6",
"latte/latte": "<2.7.1",
"tracy/tracy": "<2.5"
},
"autoload": {
Expand Down
6 changes: 4 additions & 2 deletions src/Bridges/ApplicationLatte/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ final public function getLatte(): Latte\Engine
*/
public function render(string $file = null, array $params = []): void
{
$this->latte->render($file ?: $this->file, $params + $this->getParameters());
Nette\Utils\Arrays::toObject($params, $this);
$this->latte->render($file ?: $this->file, $this);
}


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


Expand Down

0 comments on commit 2fd8987

Please sign in to comment.