Skip to content

Commit

Permalink
add config for navigation_label
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Mar 30, 2024
1 parent 8102a5c commit 651fe22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/curator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'label' => 'Media',
'plural_label' => 'Media',
'navigation_group' => null,
'navigation_label' => 'Media',
'navigation_icon' => 'heroicon-o-photo',
'navigation_sort' => null,
'navigation_count_badge' => false,
Expand Down
14 changes: 14 additions & 0 deletions src/CuratorPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class CuratorPlugin implements Plugin

protected string | Closure | null $navigationGroup = null;

protected string | Closure | null $navigationLabel = null;

protected ?string $navigationIcon = null;

protected ?int $navigationSort = null;
Expand Down Expand Up @@ -85,6 +87,11 @@ public function getNavigationGroup(): ?string
return $this->evaluate($this->navigationGroup) ?? config('curator.resources.navigation_group');
}

public function getNavigationLabel(): ?string
{
return $this->evaluate($this->navigationLabel) ?? config('curator.resources.navigation_label');
}

public function getNavigationIcon(): ?string
{
return $this->navigationIcon ?? config('curator.resources.navigation_icon');
Expand Down Expand Up @@ -117,6 +124,13 @@ public function navigationGroup(string | Closure | null $group = null): static
return $this;
}

public function navigationLabel(string | Closure | null $label = null): static
{
$this->navigationLabel = $label;

return $this;
}

public function navigationIcon(string $icon): static
{
$this->navigationIcon = $icon;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/MediaResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function getPluralModelLabel(): string

public static function getNavigationLabel(): string
{
return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel());
return CuratorPlugin::get()->getNavigationLabel() ?? Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel());
}

public static function getNavigationIcon(): string
Expand Down

0 comments on commit 651fe22

Please sign in to comment.