Skip to content
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

allow to hide tag resource #170

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ trait Configuration

protected bool $hasLibraryResource = true;

protected bool $hasTagResource = true;

/*
* @deprecated deprecated since version 3.2
*/
Expand Down Expand Up @@ -389,6 +391,18 @@ public function hasLibraryResource(): bool
return $this->hasLibraryResource;
}

public function tagResource(bool $condition = true): static
{
$this->hasTagResource = $condition;

return $this;
}

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

public function libraryTypes(array $types): static
{
$this->libraryTypes = $types;
Expand Down
4 changes: 3 additions & 1 deletion src/SkyPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function register(Panel $panel): void
$panel->resources([LibraryResource::class]);
}

$panel->resources([TagResource::class]);
if ($this->hasTagResource()) {
$panel->resources([TagResource::class]);
}
}

public static function make(): static
Expand Down