diff --git a/src/Datagrid.blocks.latte b/src/Datagrid.blocks.latte
index da51d4e..f38ba09 100644
--- a/src/Datagrid.blocks.latte
+++ b/src/Datagrid.blocks.latte
@@ -88,7 +88,7 @@
{/define}
{define row-actions-edit-link}
- {$control->translate(nextras.datagrid.edit.label)}
+ {_}nextras.datagrid.edit.label{/_}
{/define}
{define row}
@@ -160,11 +160,11 @@
{define pagination}
{/define}
diff --git a/src/Datagrid.php b/src/Datagrid.php
index 3fd3586..9b35a7c 100644
--- a/src/Datagrid.php
+++ b/src/Datagrid.php
@@ -273,6 +273,10 @@ public function translate($s, $count = null)
public function render()
{
+ if (!$this->template instanceof Template) {
+ throw new LogicException('Template must be instance of ' . Template::class);
+ }
+
if ($this->filterFormFactory) {
$this['form']['filter']->setDefaults($this->filter);
}
@@ -288,6 +292,8 @@ public function render()
$this->template->showFilterCancel = $this->filterDataSource != $this->filterDefaults; // @ intentionaly
$this->template->setFile(__DIR__ . '/Datagrid.latte');
+ $this->template->setTranslator($this->translator);
+
$this->onRender($this);
$this->template->render();
}
diff --git a/src/exceptions.php b/src/exceptions.php
index d33178c..33a9616 100644
--- a/src/exceptions.php
+++ b/src/exceptions.php
@@ -13,3 +13,8 @@
class InvalidArgumentException extends \InvalidArgumentException
{
}
+
+
+class LogicException extends \LogicException
+{
+}