Update Composer packages
This commit is contained in:
parent
0320235f6c
commit
a8b68fb61b
378 changed files with 28466 additions and 28852 deletions
|
@ -86,11 +86,7 @@ class PagePicker extends Picker
|
|||
return $this->parent();
|
||||
}
|
||||
|
||||
if ($items = $this->items()) {
|
||||
return $items->parent();
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->items()?->parent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,14 +97,14 @@ class PagePicker extends Picker
|
|||
* @param \Kirby\Cms\Site|\Kirby\Cms\Page|null
|
||||
* @return array|null
|
||||
*/
|
||||
public function modelToArray($model = null): ?array
|
||||
public function modelToArray($model = null): array|null
|
||||
{
|
||||
if ($model === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// the selected model is the site. there's nothing above
|
||||
if (is_a($model, 'Kirby\Cms\Site') === true) {
|
||||
if ($model instanceof Site) {
|
||||
return [
|
||||
'id' => null,
|
||||
'parent' => null,
|
||||
|
@ -200,13 +196,13 @@ class PagePicker extends Picker
|
|||
// help mitigate some typical query usage issues
|
||||
// by converting site and page objects to proper
|
||||
// pages by returning their children
|
||||
if (is_a($items, 'Kirby\Cms\Site') === true) {
|
||||
$items = $items->children();
|
||||
} elseif (is_a($items, 'Kirby\Cms\Page') === true) {
|
||||
$items = $items->children();
|
||||
} elseif (is_a($items, 'Kirby\Cms\Pages') === false) {
|
||||
throw new InvalidArgumentException('Your query must return a set of pages');
|
||||
}
|
||||
$items = match (true) {
|
||||
$items instanceof Site,
|
||||
$items instanceof Page => $items->children(),
|
||||
$items instanceof Pages => $items,
|
||||
|
||||
default => throw new InvalidArgumentException('Your query must return a set of pages')
|
||||
};
|
||||
|
||||
return $this->itemsForQuery = $items;
|
||||
}
|
||||
|
@ -238,11 +234,7 @@ class PagePicker extends Picker
|
|||
public function start()
|
||||
{
|
||||
if (empty($this->options['query']) === false) {
|
||||
if ($items = $this->itemsForQuery()) {
|
||||
return $items->parent();
|
||||
}
|
||||
|
||||
return $this->site;
|
||||
return $this->itemsForQuery()?->parent() ?? $this->site;
|
||||
}
|
||||
|
||||
return $this->site;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue