8000 Menu improvements by simonhamp · Pull Request #423 · NativePHP/laravel · GitHub
[go: up one dir, main page]

Skip to content

Menu improvements #423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Support radio items
  • Loading branch information
simonhamp committed Nov 20, 2024
commit 37f0040bc2aa7dff5ee6a3a7babce8d555027874
2 changes: 1 addition & 1 deletion src/Menu/Items/Radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Radio extends MenuItem
{
protected string $type = 'radio';

public function __construct(string $label)
public function __construct(string $label, protected bool $isChecked = false, protected ?string $accelerator = null)
{
$this->label = $label;
}
Expand Down
6 changes: 6 additions & 0 deletions src/Menu/MenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Native\Laravel\Client\Client;
use Native\Laravel\Contracts\MenuItem;
use Native\Laravel\Enums\RolesEnum;
use Native\Laravel\Menu\Items;

class MenuBuilder
{
Expand Down Expand Up @@ -58,6 +59,11 @@ public function checkbox(string $label, bool $checked = false, ?string $hotkey =
return new Items\Checkbox($label, $checked, $hotkey);
}

public function radio(string $label, bool $checked = false, ?string $hotkey = null): Items\Radio
{
return new Items\Radio($label, $checked, $hotkey);
}

public function event(string $event, ?string $label = null, ?string $hotkey = null): Items\Event
{
return new Items\Event($event, $label, $hotkey);
Expand Down
0