Upgrade to 3.6.1
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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();
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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()) {
|
||||
|
@@ -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 = [
|
||||
|
Reference in New Issue
Block a user