Upgrade to 3.6.1
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Closure;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
@@ -42,7 +43,7 @@ class Fieldsets extends Items
|
||||
$fieldset = Blueprint::extend($fieldset);
|
||||
|
||||
// make sure the type is always set
|
||||
$fieldset['type'] = $fieldset['type'] ?? $type;
|
||||
$fieldset['type'] ??= $type;
|
||||
|
||||
// extract groups
|
||||
if ($fieldset['type'] === 'group') {
|
||||
@@ -69,7 +70,7 @@ class Fieldsets extends Items
|
||||
|
||||
public static function factory(array $items = null, array $params = [])
|
||||
{
|
||||
$items = $items ?? option('blocks.fieldsets', [
|
||||
$items ??= option('blocks.fieldsets', [
|
||||
'code' => 'blocks/code',
|
||||
'gallery' => 'blocks/gallery',
|
||||
'heading' => 'blocks/heading',
|
||||
@@ -94,8 +95,9 @@ class Fieldsets extends Items
|
||||
|
||||
public function toArray(?Closure $map = null): array
|
||||
{
|
||||
return array_map($map ?? function ($fieldset) {
|
||||
return $fieldset->toArray();
|
||||
}, $this->data);
|
||||
return A::map(
|
||||
$this->data,
|
||||
$map ?? fn ($fieldset) => $fieldset->toArray()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user