diff --git a/docs/src/docs/components/actions.md b/docs/src/docs/components/actions.md
index af02e63e..3cdf61f3 100644
--- a/docs/src/docs/components/actions.md
+++ b/docs/src/docs/components/actions.md
@@ -585,9 +585,11 @@ $builder
->addRowAction('advanced', DropdownActionType::class, [
'actions' => [
$builder->createRowAction('update', LinkDropdownItemActionType::class, [
- 'href' => fn (Post $post) => $this->urlGenerator->generate('post_delete', [
- 'id' => $post->getId(),
- ]),
+ 'href' => function (Post $post) {
+ return $this->urlGenerator->generate('post_delete', [
+ 'id' => $post->getId(),
+ ]),
+ },
]),
],
])
diff --git a/docs/src/reference/types/action.md b/docs/src/reference/types/action.md
index 8573bfe8..093d2127 100644
--- a/docs/src/reference/types/action.md
+++ b/docs/src/reference/types/action.md
@@ -2,7 +2,9 @@
The following action types are natively available in the bundle:
-- [Link](#)
-- [Button](#)
-- [Callback](#)
-- [Action](#)
+- [Link](action/link.md)
+- [Button](action/button.md)
+- [Form](action/form.md)
+- [Dropdown](action/dropdown.md)
+ - [LinkDropdownItem](action/link-dropdown-item.md)
+- [Action](action/action.md)
diff --git a/docs/src/reference/types/action/link-dropdown-item.md b/docs/src/reference/types/action/link-dropdown-item.md
index da18ae7f..6e609388 100644
--- a/docs/src/reference/types/action/link-dropdown-item.md
+++ b/docs/src/reference/types/action/link-dropdown-item.md
@@ -24,9 +24,7 @@ $builder
->addAction('advanced', DropdownActionType::class, [
'actions' => [
$builder->createAction('update', LinkDropdownItemActionType::class, [
- 'href' => fn (Post $post) => $this->urlGenerator->generate('post_update', [
- 'id' => $post->getId(),
- ]),
+ 'href' => '#',
]),
],
])
@@ -44,9 +42,11 @@ $builder
->addRowAction('advanced', DropdownActionType::class, [
'actions' => [
$builder->createRowAction('update', LinkDropdownItemActionType::class, [
- 'href' => fn (Post $post) => $this->urlGenerator->generate('post_update', [
- 'id' => $post->getId(),
- ]),
+ 'href' => function (Post $post) {
+ return $this->urlGenerator->generate('post_update', [
+ 'id' => $post->getId(),
+ ]);
+ },
]),
],
])
@@ -55,7 +55,7 @@ $builder
### `target`
-- **type**: `string` or `callable`
+- **type**: `string` or `callable` (if using as a row action)
- **default**: `'_self'`
Sets the value that will be used as an anchor [target attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target).
@@ -76,6 +76,27 @@ $builder
;
```
+When using the `LinkActionType` as a [row action](../../../docs/components/actions.md), you can provide a callable
+that will receive the row data as an argument and should return a string.
+
+```php
+use Kreyu\Bundle\DataTableBundle\Action\Type\Dropdown\DropdownActionType;
+use Kreyu\Bundle\DataTableBundle\Action\Type\Dropdown\LinkDropdownItemActionType;
+
+$builder
+ ->addAction('advanced', DropdownActionType::class, [
+ 'actions' => [
+ $builder->createRowAction('wiki', LinkDropdownItemActionType::class, [
+ 'target' => function (Configuration $configuration) {
+ return $configuration->isExternal() ? '_blank' : '_self';
+ },
+ ])
+ ],
+ ])
+
+;
+```
+
## Inherited options
diff --git a/docs/src/reference/types/action/link.md b/docs/src/reference/types/action/link.md
index 7b158961..d56e92fd 100644
--- a/docs/src/reference/types/action/link.md
+++ b/docs/src/reference/types/action/link.md
@@ -10,12 +10,12 @@ The [`LinkActionType`](https://github.com/Kreyu/data-table-bundle/blob/main/src/
### `href`
-- **type**: `string` or `callable`
+- **type**: `string` or `callable` (if using as a row action)
- **default**: `'#'`
A value used as an action link [href attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href).
-```php #
+```php
use Kreyu\Bundle\DataTableBundle\Action\Type\LinkActionType;
$builder
@@ -25,14 +25,31 @@ $builder
;
```
+When using the `LinkActionType` as a [row action](../../../docs/components/actions.md), you can provide a callable
+that will receive the row data as an argument and should return a string.
+
+```php
+use Kreyu\Bundle\DataTableBundle\Action\Type\LinkActionType;
+
+$builder
+ ->addAction('back', LinkActionType::class, [
+ 'href' => function (Category $category) {
+ return $this->urlGenerator->generate('category_index', [
+ 'id' => $category->getId(),
+ ]);
+ },
+ ])
+;
+```
+
### `target`
-- **type**: `string` or `callable`
+- **type**: `string` or `callable` (if using as a row action)
- **default**: `'_self'`
Sets the value that will be used as an anchor [target attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target).
-```php #
+```php
use Kreyu\Bundle\DataTableBundle\Action\Type\LinkActionType;
$builder
@@ -42,6 +59,21 @@ $builder
;
```
+When using the `LinkActionType` as a [row action](../../../docs/components/actions.md), you can provide a callable
+that will receive the row data as an argument and should return a string.
+
+```php
+use Kreyu\Bundle\DataTableBundle\Action\Type\LinkActionType;
+
+$builder
+ ->addRowAction('wiki', LinkActionType::class, [
+ 'target' => function (Configuration $configuration) {
+ return $configuration->shouldOpenNewTab() ? '_blank' : '_self';
+ },
+ ])
+;
+```
+
## Inherited options