From b9f2c33a0a3a7e74c0e5ddaec7ade445142bdb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=20D=C3=A9veloppe?= <89155041+JeDeveloppe@users.noreply.github.com> Date: Sat, 13 Sep 2025 19:35:50 +0200 Subject: [PATCH] Update Icon.php --- src/Map/src/Icon/Icon.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Map/src/Icon/Icon.php b/src/Map/src/Icon/Icon.php index d097952de23..cc1ccea7dfc 100644 --- a/src/Map/src/Icon/Icon.php +++ b/src/Map/src/Icon/Icon.php @@ -61,6 +61,7 @@ protected function __construct( protected IconType $type, protected int $width = 24, protected int $height = 24, + protected ?string $color = null, // Nouvelle propriété pour la couleur ) { } @@ -88,6 +89,20 @@ public function height(int $height): static return $this; } + /** + * Sets the color of the icon. + * Note: This only has an effect on SvgIcon and UxIcon types when rendered client-side by the JavaScript controller. + * The color should be a valid CSS color string (e.g., 'red', '#FF0000', 'rgb(255,0,0)'). + * + * @param non-empty-string $color + */ + public function color(string $color): static + { + $this->color = $color; + + return $this; + } + /** * @internal */ @@ -97,14 +112,15 @@ public function toArray(): array 'type' => $this->type->value, 'width' => $this->width, 'height' => $this->height, + 'color' => $this->color, // Ajout de la couleur au tableau de sérialisation ]; } /** - * @param array{ type: value-of, width: positive-int, height: positive-int } - * &(array{ url: non-empty-string } - * |array{ html: non-empty-string } - * |array{ name: non-empty-string }) $data + * @param array{ type: value-of, width: positive-int, height: positive-int, color?: string } + * &(array{ url: non-empty-string } + * |array{ html: non-empty-string } + * |array{ name: non-empty-string }) $data * * @internal */