Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update libs/NiftyGrid/GridPaginator.php (~based on: #34

Open
wants to merge 3 commits into from

1 participant

@j3nda

hi,

this is feature for: GridPaginator() to use better setting of template by $templatePath.
it's inspired by practical usage and existing pullrequest ~ #32 .

difference between "vinam" and "j3nda" is:

  • public function __construct($templatePath = null)
  • protected function setTemplate($templatePath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 6 deletions.
  1. +18 −6 libs/NiftyGrid/GridPaginator.php
View
24 libs/NiftyGrid/GridPaginator.php
@@ -16,21 +16,24 @@ class GridPaginator extends \Nette\Application\UI\Control
/** @persistent int */
public $page = 1;
- /**
- * @var Paginator
- */
+ /** @var Paginator */
public $paginator;
- public function __construct()
+ /** @var string */
+ protected $templatePath = null;
+
+
+ public function __construct($templatePath = null)
{
parent::__construct();
$this->paginator = new Paginator;
+ $this->setTemplate($templatePath);
}
public function render()
{
$this->template->paginator = $this->paginator;
- $this->template->setFile(__DIR__ . '/../../templates/paginator.latte');
+ $this->template->setFile(!empty($this->templatePath) ? $this->templatePath : __DIR__ . '/../../templates/paginator.latte');
$this->template->render();
}
@@ -42,4 +45,13 @@ public function loadState(array $params)
parent::loadState($params);
$this->paginator->page = $this->page;
}
-}
+
+ /**
+ * @param string $templatePath
+ */
+ public function setTemplate($templatePath)
+ {
+ $this->templatePath = $templatePath;
+ }
+
+}
Something went wrong with that request. Please try again.