Upgrade to 4.5.0

This commit is contained in:
Bastian Allgeier
2024-11-28 11:24:28 +01:00
parent 49287c7a5e
commit 63ddf40692
86 changed files with 942 additions and 491 deletions

View File

@@ -28,7 +28,9 @@ class OptionsApi extends OptionsProvider
public string $url,
public string|null $query = null,
public string|null $text = null,
public string|null $value = null
public string|null $value = null,
public string|null $icon = null,
public string|null $info = null
) {
}
@@ -46,10 +48,12 @@ class OptionsApi extends OptionsProvider
}
return new static(
url: $props['url'],
url : $props['url'],
query: $props['query'] ?? $props['fetch'] ?? null,
text: $props['text'] ?? null,
value: $props['value'] ?? null
text : $props['text'] ?? null,
value: $props['value'] ?? null,
icon : $props['icon'] ?? null,
info : $props['info'] ?? null
);
}
@@ -138,7 +142,10 @@ class OptionsApi extends OptionsProvider
'value' => $model->toString($this->value, ['item' => $item]),
// text is only a raw string when using {< >}
// or when the safe mode is explicitly disabled (select field)
'text' => $model->$safeMethod($this->text, ['item' => $item])
'text' => $model->$safeMethod($this->text, ['item' => $item]),
// additional data
'icon' => $this->icon !== null ? $model->toString($this->icon, ['item' => $item]) : null,
'info' => $this->info !== null ? $model->$safeMethod($this->info, ['item' => $item]) : null
];
}

View File

@@ -30,7 +30,9 @@ class OptionsQuery extends OptionsProvider
public function __construct(
public string $query,
public string|null $text = null,
public string|null $value = null
public string|null $value = null,
public string|null $icon = null,
public string|null $info = null
) {
}
@@ -56,8 +58,10 @@ class OptionsQuery extends OptionsProvider
return new static(
query: $props['query'] ?? $props['fetch'],
text: $props['text'] ?? null,
value: $props['value'] ?? null
text : $props['text'] ?? null,
value: $props['value'] ?? null,
icon : $props['icon'] ?? null,
info : $props['info'] ?? null
);
}
@@ -178,7 +182,11 @@ class OptionsQuery extends OptionsProvider
$safeMethod = $safeMode === true ? 'toSafeString' : 'toString';
$text = $model->$safeMethod($this->text ?? $text, $data);
return compact('text', 'value');
// additional data
$icon = $this->icon !== null ? $model->toString($this->icon, $data) : null;
$info = $this->info !== null ? $model->$safeMethod($this->info, $data) : null;
return compact('text', 'value', 'icon', 'info');
});
return $this->options = Options::factory($options);