Skip to content

Commit c1874ee

Browse files
committed
Add id's to menu items
1 parent 4ad23a6 commit c1874ee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Menu/Items/MenuItem.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ abstract class MenuItem implements MenuItemContract
1010
{
1111
protected string $type = 'normal';
1212

13+
protected ?string $id = null;
14+
1315
protected ?string $label = null;
1416

1517
protected ?string $sublabel = null;
@@ -42,6 +44,13 @@ public function disabled(): self
4244
return $this;
4345
}
4446

47+
public function id(string $id): self
48+
{
49+
$this->id = $id;
50+
51+
return $this;
52+
}
53+
4554
public function label(string $label): self
4655
{
4756
$this->label = $label;
@@ -84,7 +93,7 @@ public function checked($checked = true): self
8493
return $this;
8594
}
8695

87-
public function toolTip(string $toolTip): self
96+
public function tooltip(string $toolTip): self
8897
{
8998
$this->toolTip = $toolTip;
9099

@@ -102,6 +111,7 @@ public function toArray(): array
102111
{
103112
return array_filter([
104113
'type' => $this->type,
114+
'id' => $this->id,
105115
'label' => $this->label,
106116
'sublabel' => $this->sublabel,
107117
'toolTip' => $this->toolTip,

0 commit comments

Comments
 (0)