Skip to content

Commit eb0e672

Browse files
committed
RatingComponent: pass given values in render() to template
1 parent 9fa4a47 commit eb0e672

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Rating/RatingComponent.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Utilitte\Components\Rating;
44

55
use Nette\Application\UI\Control;
6-
use Nette\Security\User;
76
use Utilitte\Components\Rating\Model\RatingModelInterface;
87
use Utilitte\Components\Rating\ValueObject\Rating;
98
use Utilitte\Components\Utility\TControl;
@@ -23,7 +22,6 @@ final class RatingComponent extends Control
2322
public function __construct(
2423
private RatingModelInterface $model,
2524
private Rating $rating,
26-
private User $user,
2725
)
2826
{
2927
}
@@ -40,7 +38,7 @@ public function onVoted(callable $callback): void
4038
$this->onVoted[] = $callback;
4139
}
4240

43-
public function render(): void
41+
public function render(mixed ... $arguments): void
4442
{
4543
$template = $this->getTemplate();
4644
$template->setFile($this->getFile(__DIR__ . '/templates/rating.latte'));
@@ -53,6 +51,10 @@ public function render(): void
5351
$template->increase = $this->increase;
5452
$template->canVote = $this->rating->canVote();
5553

54+
foreach ($arguments as $name => $value) {
55+
$template->$name = $value;
56+
}
57+
5658
$template->render();
5759
}
5860

0 commit comments

Comments
 (0)