Skip to content

Commit

Permalink
Merge pull request #48 from Senexis/feature-custom-link-toggle
Browse files Browse the repository at this point in the history
Add option to disable the create custom link panel.
  • Loading branch information
datlechin authored Nov 6, 2024
2 parents a4bb3ee + f0a815a commit 46f7541
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resources/views/edit-record.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
<livewire:menu-builder-panel :menu="$record" :menuPanel="$menuPanel" />
@endforeach

<livewire:create-custom-link :menu="$record" />
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomLink())
<livewire:create-custom-link :menu="$record" />
@endif
</div>
<div class="col-span-12 sm:col-span-8">
<x-filament::section>
Expand Down
14 changes: 14 additions & 0 deletions src/FilamentMenuBuilderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class FilamentMenuBuilderPlugin implements Plugin
*/
protected array $menuPanels = [];

protected bool $showCustomLink = true;

public function getId(): string
{
return 'menu-builder';
Expand Down Expand Up @@ -124,6 +126,13 @@ public function addMenuPanels(array $menuPanels): static
return $this;
}

public function showCustomLink(bool $show = true): static
{
$this->showCustomLink = $show;

return $this;
}

public function addMenuFields(array | Closure $schema): static
{
$this->menuFields = $schema;
Expand Down Expand Up @@ -168,6 +177,11 @@ public function getMenuPanels(): array
->all();
}

public function isShowCustomLink(): bool
{
return $this->showCustomLink;
}

public function getLocations(): array
{
return $this->locations;
Expand Down

0 comments on commit 46f7541

Please sign in to comment.