Skip to content

Commit

Permalink
Change method names, update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Senexis authored Nov 6, 2024
1 parent d1775c4 commit c806a48
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,26 @@ By default, the package provides a **Custom Link** menu panel that allows you to

![Custom Link Menu Panel](https://github.com/datlechin/filament-menu-builder/raw/main/art/custom-link.png)

The panel can be disabled by using the following when configuring the plugin, should you not need this functionality.

```php
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
...
->plugin(
FilamentMenuBuilderPlugin::make()
->showCustomLinkPanel(false)
)
```

#### Custom Text Menu Panel

By default, the package provides a **Custom Text** menu panel that allows you to add custom text items to the menus.
This package provides a **Custom Text** menu panel that allows you to add custom text items to the menus.

It is identical to the **Custom Link** menu except for the fact that you're not required to set a URL or target. This can be useful to add headers to mega-style menus.
It is identical to the **Custom Link** menu panel except for the fact that you only set a title without a URL or target. This can be useful to add headers to mega-style menus.

To enable the **Custom Text** menu panel, you can use the following when configuring the plugin.
The panel is disabled by default to prevent visual clutter. To enable the Custom Text menu panel, you can use the following when configuring the plugin.

```php
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
Expand All @@ -120,7 +133,7 @@ $panel
...
->plugin(
FilamentMenuBuilderPlugin::make()
->showCustomText()
->showCustomTextPanel()
)
```

Expand Down
4 changes: 2 additions & 2 deletions resources/views/edit-record.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<livewire:menu-builder-panel :menu="$record" :menuPanel="$menuPanel" />
@endforeach

@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomLink())
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomLinkPanel())
<livewire:create-custom-link :menu="$record" />
@endif

@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomText())
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomTextPanel())
<livewire:create-custom-text :menu="$record" />
@endif
</div>
Expand Down
20 changes: 10 additions & 10 deletions src/FilamentMenuBuilderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class FilamentMenuBuilderPlugin implements Plugin
*/
protected array $menuPanels = [];

protected bool $showCustomLink = true;
protected bool $showCustomLinkPanel = true;

protected bool $showCustomText = false;
protected bool $showCustomTextPanel = false;

public function getId(): string
{
Expand Down Expand Up @@ -128,16 +128,16 @@ public function addMenuPanels(array $menuPanels): static
return $this;
}

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

return $this;
}

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

return $this;
}
Expand Down Expand Up @@ -186,14 +186,14 @@ public function getMenuPanels(): array
->all();
}

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

public function isShowCustomText(): bool
public function isShowCustomTextPanel(): bool
{
return $this->showCustomText;
return $this->showCustomTextPanel;
}

public function getLocations(): array
Expand Down

0 comments on commit c806a48

Please sign in to comment.