Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Attribute/AdminDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public function __construct(
/**
* @var string|null $routePath The path of the Symfony route that will be created for the dashboard (e.g. '/admin)
*/
public /* ?string */ $routePath = null,
/* ?string */ public $routePath = null,
/**
* @var string|null $routeName The name of the Symfony route that will be created for the dashboard (e.g. 'admin')
*/
public /* ?string */ $routeName = null,
/* ?string */ public $routeName = null,
/**
* @var array{
* requirements?: array<string, string>,
Expand Down
35 changes: 35 additions & 0 deletions src/Dto/ActionDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Dto;

use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use Symfony\Contracts\Translation\TranslatableInterface;

/**
Expand Down Expand Up @@ -32,6 +33,17 @@ final class ActionDto
private array $translationParameters = [];
/** @var callable|null */
private $displayCallable;
private KeyValueStore $customOptions;

public function __construct()
{
$this->customOptions = KeyValueStore::new();
}

public function __clone()
{
$this->customOptions = clone $this->customOptions;
}

public function getType(): string
{
Expand Down Expand Up @@ -332,4 +344,27 @@ public function getAsConfigObject(): Action

return $action;
}

public function getCustomOptions(): KeyValueStore
{
return $this->customOptions;
}

public function getCustomOption(string $optionName): mixed
{
return $this->customOptions->get($optionName);
}

/**
* @param array<string, mixed> $customOptions
*/
public function setCustomOptions(array $customOptions): void
{
$this->customOptions = KeyValueStore::new($customOptions);
}

public function setCustomOption(string $optionName, mixed $optionValue): void
{
$this->customOptions->set($optionName, $optionValue);
}
}
Loading