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

@@ -71,8 +71,8 @@ class Field extends Component
$this->formFields = $formFields;
// use the type as fallback for the name
$attrs['name'] = $attrs['name'] ?? $type;
$attrs['type'] = $type;
$attrs['name'] ??= $type;
$attrs['type'] = $type;
parent::__construct($type, $attrs);
}
@@ -440,9 +440,10 @@ class Field extends Component
ksort($array);
return array_filter($array, function ($item) {
return $item !== null && is_object($item) === false;
});
return array_filter(
$array,
fn ($item) => $item !== null && is_object($item) === false
);
}
/**

View File

@@ -49,7 +49,7 @@ class BlocksField extends FieldClass
$type = $block['type'];
// get and cache fields at the same time
$fields[$type] = $fields[$type] ?? $this->fields($block['type']);
$fields[$type] ??= $this->fields($block['type']);
// overwrite the block content with form values
$block['content'] = $this->form($fields[$type], $block['content'])->$to();

View File

@@ -116,9 +116,10 @@ class LayoutField extends BlocksField
protected function setLayouts(array $layouts = [])
{
$this->layouts = array_map(function ($layout) {
return Str::split($layout);
}, $layouts);
$this->layouts = array_map(
fn ($layout) => Str::split($layout),
$layouts
);
}
protected function setSettings($settings = null)

View File

@@ -726,9 +726,7 @@ abstract class FieldClass
ksort($props);
return array_filter($props, function ($item) {
return $item !== null;
});
return array_filter($props, fn ($item) => $item !== null);
}
/**

View File

@@ -29,7 +29,7 @@ class Fields extends Collection
{
if (is_array($field) === true) {
// use the array key as name if the name is not set
$field['name'] = $field['name'] ?? $name;
$field['name'] ??= $name;
$field = Field::factory($field['type'], $field, $this);
}

View File

@@ -268,9 +268,9 @@ class Form
}
// set a few defaults
$props['values'] = array_merge($original, $values);
$props['fields'] = $props['fields'] ?? [];
$props['model'] = $model;
$props['values'] = array_merge($original, $values);
$props['fields'] ??= [];
$props['model'] = $model;
// search for the blueprint
if (method_exists($model, 'blueprint') === true && $blueprint = $model->blueprint()) {

View File

@@ -45,10 +45,10 @@ class Options
*/
public static function api($api, $model = null): array
{
$model = $model ?? App::instance()->site();
$fetch = null;
$text = null;
$value = null;
$model ??= App::instance()->site();
$fetch = null;
$text = null;
$value = null;
if (is_array($api) === true) {
$fetch = $api['fetch'] ?? null;
@@ -165,7 +165,7 @@ class Options
*/
public static function query($query, $model = null): array
{
$model = $model ?? App::instance()->site();
$model ??= App::instance()->site();
// default text setup
$text = [