Upgrade to 3.9.2

This commit is contained in:
Bastian Allgeier
2023-03-08 12:24:06 +01:00
parent c58864a585
commit 3b0b4feb16
44 changed files with 672 additions and 201 deletions

View File

@@ -19,6 +19,8 @@ class Items extends Collection
{
public const ITEM_CLASS = Item::class;
protected Field|null $field;
/**
* @var array
*/
@@ -39,6 +41,7 @@ class Items extends Collection
{
$this->options = $options;
$this->parent = $options['parent'] ?? App::instance()->site();
$this->field = $options['field'] ?? null;
parent::__construct($objects, $this->parent);
}
@@ -54,6 +57,7 @@ class Items extends Collection
public static function factory(array $items = null, array $params = [])
{
$options = array_merge([
'field' => null,
'options' => [],
'parent' => App::instance()->site(),
], $params);
@@ -74,6 +78,7 @@ class Items extends Collection
continue;
}
$params['field'] = $options['field'];
$params['options'] = $options['options'];
$params['parent'] = $options['parent'];
$params['siblings'] = $collection;
@@ -85,6 +90,14 @@ class Items extends Collection
return $collection;
}
/**
* Returns the parent field if known
*/
public function field(): Field|null
{
return $this->field;
}
/**
* Convert the items to an array
*