Upgrade to 3.9.6
This commit is contained in:
@@ -367,14 +367,14 @@ class App
|
||||
* @return \Kirby\Toolkit\Collection|null
|
||||
* @todo 5.0 Add return type declaration
|
||||
*/
|
||||
public function collection(string $name)
|
||||
public function collection(string $name, array $options = [])
|
||||
{
|
||||
return $this->collections()->get($name, [
|
||||
return $this->collections()->get($name, array_merge($options, [
|
||||
'kirby' => $this,
|
||||
'site' => $this->site(),
|
||||
'pages' => $this->site()->children(),
|
||||
'site' => $site = $this->site(),
|
||||
'pages' => $site->children(),
|
||||
'users' => $this->users()
|
||||
]);
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,7 +580,14 @@ class App
|
||||
$visitor = $this->visitor();
|
||||
|
||||
foreach ($visitor->acceptedLanguages() as $acceptedLang) {
|
||||
$closure = fn ($language) => $language->locale(LC_ALL) === $acceptedLang->locale();
|
||||
$closure = function ($language) use ($acceptedLang) {
|
||||
$languageLocale = $language->locale(LC_ALL);
|
||||
$acceptedLocale = $acceptedLang->locale();
|
||||
|
||||
return $languageLocale === $acceptedLocale ||
|
||||
$acceptedLocale === Str::substr($languageLocale, 0, 2);
|
||||
};
|
||||
|
||||
if ($language = $languages->filter($closure)?->first()) {
|
||||
return $language;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user