Skip to content

Commit

Permalink
Merge a8ef63b into 26c324d
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign committed Aug 29, 2020
2 parents 26c324d + a8ef63b commit 91edc13
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,18 +791,21 @@ public function normalizePageNumber($pageNumber)
/**
* Renders the paginator.
*
* @param \Laminas\View\Renderer\RendererInterface $view
* @param View\Renderer\RendererInterface|null $view
* @param array $params
* @return string
*/
public function render(View\Renderer\RendererInterface $view = null)
{
public function render(
View\Renderer\RendererInterface $view = null,
array $params = []
) {
if (null !== $view) {
$this->setView($view);
}

$view = $this->getView();

return $view->paginationControl($this);
return $view->paginationControl($this, null, null, $params);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions test/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@ public function testRendersWithPartial()
$this->assertEquals('partial rendered successfully', $string);
}

public function testSetParamsOnRenderShouldPassToView()
{
$view = new View\Renderer\PhpRenderer();
$view->resolver()->addPath(__DIR__ . '/_files/scripts');

Helper\PaginationControl::setDefaultViewPartial('partial-with-vars.phtml');

$message = 'partial rendered successfully with vars';
$this->assertSame(
'partial rendered successfully with vars',
$this->paginator->render($view, ['message' => $message])
);
}

public function testGetsPageCount()
{
$this->assertEquals(11, $this->paginator->count());
Expand Down
1 change: 1 addition & 0 deletions test/_files/scripts/partial-with-vars.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?= $message ?>

0 comments on commit 91edc13

Please sign in to comment.