Skip to content

Commit

Permalink
Merge pull request #37 from BobWez98/feature/hide-collections
Browse files Browse the repository at this point in the history
  • Loading branch information
tdwesten authored Nov 5, 2024
2 parents d1fc80e + 59cf18f commit ad04616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/BaseCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ abstract public function futureDateBehavior(): ?string;

abstract public function pastDateBehavior(): ?string;

public function visible(): bool
{
return true;
}

public function register()
{
$collection = StatamicCollection::make($this->handle())
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/CollectionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function all(): IlluminateCollection
$keys = $this->store->paths()->keys();

// add custom collections
$keys = $this->collections->keys()->merge($keys);
$keys = $this->collections->keys()->filter(fn ($collection) => $this->getCollectionByHandle($collection)->visible())->merge($keys);

return $this->store->getItems($keys, $this->collections);
}
Expand Down

0 comments on commit ad04616

Please sign in to comment.