Upgrade to 3.9.2
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user