From 10c169cf3401a95bb93722b05d9c91f40a4d745e Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Wed, 14 Feb 2024 20:52:03 +0800 Subject: [PATCH] Menu Node add extra --- src/Menu/Tree/MenuNode.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Menu/Tree/MenuNode.php b/src/Menu/Tree/MenuNode.php index 6ade9f49..c018ba57 100644 --- a/src/Menu/Tree/MenuNode.php +++ b/src/Menu/Tree/MenuNode.php @@ -37,6 +37,8 @@ class MenuNode extends Node implements MenuNodeInterface protected ?bool $forceActive = null; + protected array $extra = []; + /** * @var callable */ @@ -370,4 +372,28 @@ public function setMenuHelper(MenuHelper $menuHelper): static return $this; } + + public function &getExtra(): array + { + return $this->extra; + } + + public function setExtra(array $extra): static + { + $this->extra = $extra; + + return $this; + } + + public function setExtraValue(string $name, mixed $value): static + { + $this->extra[$name] = $value; + + return $this; + } + + public function getExtraValue(string $name): mixed + { + return $this->extra[$name] ?? null; + } }