meta at hooks

This commit is contained in:
Kavalar 2024-07-31 12:48:26 +03:00
parent b7fea4122c
commit d6d703aaa6
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ $table = new ListJsonTable($json);
$table->setBeforePrintCell(function ($key, $data) { $table->setBeforePrintCell(function ($key, $data) {
return $key == "email" ? "<span style='color: aqua'>$data</span>" : $data; return $key == "email" ? "<span style='color: aqua'>$data</span>" : $data;
}); });
$table->afterPrint(function () { $table->afterPrint(function ($meta) {
return "<div>After Print</div>"; return "<div>After Print</div>";
}); });
$table->create(); $table->create();

View File

@ -42,7 +42,7 @@ class ListJsonTable
{ {
$paramsStr = $this->createParams($this->data['meta']['params']); $paramsStr = $this->createParams($this->data['meta']['params']);
$hookBefore = $this->beforePrintHook; $hookBefore = $this->beforePrintHook;
$this->html .= $hookBefore(); $this->html .= $hookBefore($this->data['meta']);
$this->html .= "<table $paramsStr>"; $this->html .= "<table $paramsStr>";
} }
@ -192,7 +192,7 @@ class ListJsonTable
{ {
$this->html .= "</table>"; $this->html .= "</table>";
$hookAfter = $this->afterPrintHook; $hookAfter = $this->afterPrintHook;
$this->html .= $hookAfter(); $this->html .= $hookAfter($this->data['meta']);
} }
public function render(): void public function render(): void