From 8a28be1c0b19aabe697098ba7af15dbe41a0b571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Wr=C3=B3blewski?= Date: Sat, 13 Jul 2024 22:01:45 +0200 Subject: [PATCH] Move default actions column type priority to type itself, instead of setting it explicitly in the builder (RE: #75) --- src/Column/Type/ActionsColumnType.php | 1 + src/DataTableBuilder.php | 1 - src/DataTableBuilderInterface.php | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Column/Type/ActionsColumnType.php b/src/Column/Type/ActionsColumnType.php index a103e75a..9db45d46 100755 --- a/src/Column/Type/ActionsColumnType.php +++ b/src/Column/Type/ActionsColumnType.php @@ -39,6 +39,7 @@ public function configureOptions(OptionsResolver $resolver): void 'export' => false, 'property_path' => false, 'actions' => [], + 'priority' => -1, ]) ->setNormalizer('actions', function (Options $options, mixed $value) { ($resolver = new OptionsResolver()) diff --git a/src/DataTableBuilder.php b/src/DataTableBuilder.php index de5717b8..bb2bfbe9 100755 --- a/src/DataTableBuilder.php +++ b/src/DataTableBuilder.php @@ -918,7 +918,6 @@ private function prependBatchCheckboxColumn(): void private function appendActionsColumn(): void { $this->addColumn(self::ACTIONS_COLUMN_NAME, ActionsColumnType::class, [ - 'priority' => self::ACTIONS_COLUMN_PRIORITY, 'actions' => $this->getRowActions(), ]); } diff --git a/src/DataTableBuilderInterface.php b/src/DataTableBuilderInterface.php index 65769139..803bde4f 100755 --- a/src/DataTableBuilderInterface.php +++ b/src/DataTableBuilderInterface.php @@ -7,6 +7,7 @@ use Kreyu\Bundle\DataTableBundle\Action\ActionBuilderInterface; use Kreyu\Bundle\DataTableBundle\Action\Type\ActionTypeInterface; use Kreyu\Bundle\DataTableBundle\Column\ColumnBuilderInterface; +use Kreyu\Bundle\DataTableBundle\Column\Type\ActionsColumnType; use Kreyu\Bundle\DataTableBundle\Column\Type\ColumnTypeInterface; use Kreyu\Bundle\DataTableBundle\Exception\InvalidArgumentException; use Kreyu\Bundle\DataTableBundle\Exporter\ExporterBuilderInterface; @@ -23,6 +24,9 @@ interface DataTableBuilderInterface extends DataTableConfigBuilderInterface public const ACTIONS_COLUMN_NAME = '__actions'; + /** + * @deprecated since 0.19.1, the default actions column priority is now set in the type class {@see ActionsColumnType::configureOptions()} + */ public const ACTIONS_COLUMN_PRIORITY = -1; public const SEARCH_FILTER_NAME = '__search';