Skip to content

Commit

Permalink
Merge pull request #1717 from hydephp/fix-datacollections-file-findin…
Browse files Browse the repository at this point in the history
…g-method-cant-be-overriden

Use late static bindings to support overriding data collections file finding
  • Loading branch information
caendesilva authored Jun 8, 2024
2 parents 4af2234 + 38f938c commit 712f93f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This serves two purposes:

### Changed
- When a navigation group is set in front matter, it will now be used regardless of the subdirectory configuration in https://github.com/hydephp/develop/pull/1703 (fixes https://github.com/hydephp/develop/issues/1515)
- Use late static bindings to support overriding data collections file finding in https://github.com/hydephp/develop/pull/1717 (fixes https://github.com/hydephp/develop/issues/1716)


### Deprecated
- for soon-to-be removed features.
Expand All @@ -25,6 +27,7 @@ This serves two purposes:

### Fixed
- Fixed explicitly set front matter navigation group behavior being dependent on subdirectory configuration, fixing https://github.com/hydephp/develop/issues/1515 in https://github.com/hydephp/develop/pull/1703
- Fixed DataCollections file finding method not being able to be overriden https://github.com/hydephp/develop/issues/1716 in https://github.com/hydephp/develop/pull/1717

### Security
- in case of vulnerabilities.
6 changes: 3 additions & 3 deletions packages/framework/src/Support/DataCollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function markdown(string $name): static
{
static::needsDirectory(static::$sourceDirectory);

return new static(DataCollections::findFiles($name, 'md')->mapWithKeys(function (string $file): array {
return new static(static::findFiles($name, 'md')->mapWithKeys(function (string $file): array {
return [static::makeIdentifier($file) => MarkdownFileParser::parse($file)];
}));
}
Expand All @@ -67,7 +67,7 @@ public static function yaml(string $name): static
{
static::needsDirectory(static::$sourceDirectory);

return new static(DataCollections::findFiles($name, ['yaml', 'yml'])->mapWithKeys(function (string $file): array {
return new static(static::findFiles($name, ['yaml', 'yml'])->mapWithKeys(function (string $file): array {
return [static::makeIdentifier($file) => MarkdownFileParser::parse($file)->matter()];
}));
}
Expand All @@ -83,7 +83,7 @@ public static function json(string $name, bool $asArray = false): static
{
static::needsDirectory(static::$sourceDirectory);

return new static(DataCollections::findFiles($name, 'json')->mapWithKeys(function (string $file) use ($asArray): array {
return new static(static::findFiles($name, 'json')->mapWithKeys(function (string $file) use ($asArray): array {
return [static::makeIdentifier($file) => json_decode(Filesystem::get($file), $asArray)];
}));
}
Expand Down

0 comments on commit 712f93f

Please sign in to comment.