From 2f884df60219ae94ffe16e0ee56bec6cb02cc822 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 12 Oct 2023 15:25:52 +0200 Subject: [PATCH] add CrudConfiguration::setGlobalBatchAction method --- src/core/Crud/CrudConfiguration.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/core/Crud/CrudConfiguration.php b/src/core/Crud/CrudConfiguration.php index 664c0a6..aec5d0f 100644 --- a/src/core/Crud/CrudConfiguration.php +++ b/src/core/Crud/CrudConfiguration.php @@ -135,7 +135,25 @@ class CrudConfiguration ); } - public function setBatchAction(string $page, string $action, string $label, callable $callback): self + public function setGlobalBatchAction( + string $page, + string $action, + string $label, + callable $callback + ): self + { + $this->setBatchAction($page, $action, $name); + $this->batchActions[$page][$action]['isGlobal'] = true; + + return $this; + } + + public function setBatchAction( + string $page, + string $action, + string $label, + callable $callback + ): self { if (!isset($this->batchActions[$page])) { $this->batchActions[$page] = []; @@ -144,6 +162,7 @@ class CrudConfiguration $this->batchActions[$page][$action] = [ 'label' => $label, 'callback' => $callback, + 'isGlobal' => false ]; return $this;