Upgrade to 3.6.1

This commit is contained in:
Bastian Allgeier
2021-12-07 12:39:37 +01:00
parent 9fc43ea22c
commit 70b8439c49
134 changed files with 19987 additions and 1100 deletions

View File

@@ -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()
);
}
}