custom ation column
This commit is contained in:
parent
4bdd883d67
commit
cf347f1dc2
@ -8,8 +8,11 @@ abstract class ActionColumn
|
|||||||
protected string $prefix;
|
protected string $prefix;
|
||||||
|
|
||||||
protected int $id;
|
protected int $id;
|
||||||
public function __construct(string $baseUrl, int $id)
|
public function __construct(string $baseUrl, int $id, string $prefix = '')
|
||||||
{
|
{
|
||||||
|
if (!empty($prefix)){
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
}
|
||||||
$this->baseUrl = $baseUrl;
|
$this->baseUrl = $baseUrl;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Itguild\Tables;
|
namespace Itguild\Tables;
|
||||||
|
|
||||||
|
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||||
use Itguild\Tables\ActionColumn\DeleteActionColumn;
|
use Itguild\Tables\ActionColumn\DeleteActionColumn;
|
||||||
use Itguild\Tables\ActionColumn\EditActionColumn;
|
use Itguild\Tables\ActionColumn\EditActionColumn;
|
||||||
use Itguild\Tables\ActionColumn\ViewActionColumn;
|
use Itguild\Tables\ActionColumn\ViewActionColumn;
|
||||||
@ -21,6 +22,7 @@ class ListJsonTable
|
|||||||
private array $data;
|
private array $data;
|
||||||
|
|
||||||
private array $actionsArray = [];
|
private array $actionsArray = [];
|
||||||
|
private array $customActionsArray = [];
|
||||||
|
|
||||||
public function __construct(string $json)
|
public function __construct(string $json)
|
||||||
{
|
{
|
||||||
@ -89,6 +91,11 @@ class ListJsonTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addAction(ActionColumn $actionColumn): void
|
||||||
|
{
|
||||||
|
$this->customActionsArray[] = $actionColumn;
|
||||||
|
}
|
||||||
|
|
||||||
private function setActions(): void
|
private function setActions(): void
|
||||||
{
|
{
|
||||||
if (isset($this->data['meta']['actions'])) {
|
if (isset($this->data['meta']['actions'])) {
|
||||||
@ -106,9 +113,10 @@ class ListJsonTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->actionsArray = array_merge($this->actionsArray, $this->customActionsArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function issetColumn($column)
|
private function issetColumn($column): bool
|
||||||
{
|
{
|
||||||
if (isset($this->data['meta']['columns'])) {
|
if (isset($this->data['meta']['columns'])) {
|
||||||
foreach ($this->data['meta']['columns'] as $key => $currentColumn) {
|
foreach ($this->data['meta']['columns'] as $key => $currentColumn) {
|
||||||
|
Loading…
Reference in New Issue
Block a user