Skip to content

Commit 597e44b

Browse files
committed
Merge branch 'feature/allow-array-and-relationship-values-together' of github.com:backstagephp/fields into feature/allow-array-and-relationship-values-together
2 parents 7d2fdc0 + 5d67657 commit 597e44b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Concerns/HasSelectableValues.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ protected static function addValuesToInput(mixed $input, mixed $field, string $t
3737
$allOptions = [];
3838

3939
// Handle relationship options
40-
if (isset($field->config[$type]) &&
40+
if (isset($field->config[$type]) &&
4141
(is_string($field->config[$type]) && $field->config[$type] === 'relationship') ||
4242
(is_array($field->config[$type]) && in_array('relationship', $field->config[$type]))) {
43-
43+
4444
$relationshipOptions = [];
4545

4646
foreach ($field->config['relations'] ?? [] as $relation) {
@@ -95,10 +95,10 @@ protected static function addValuesToInput(mixed $input, mixed $field, string $t
9595
}
9696

9797
// Handle array options
98-
if (isset($field->config[$type]) &&
98+
if (isset($field->config[$type]) &&
9999
(is_string($field->config[$type]) && $field->config[$type] === 'array') ||
100100
(is_array($field->config[$type]) && in_array('array', $field->config[$type]))) {
101-
101+
102102
if (isset($field->config['options']) && is_array($field->config['options'])) {
103103
// If both types are selected, group array options
104104
if (isset($field->config[$type]) &&
@@ -149,12 +149,12 @@ protected function selectableValuesFormFields(string $type, string $label, strin
149149
$arrayComponent::make('config.options')
150150
->label(__('Options'))
151151
->columnSpanFull()
152-
->visible(fn (Forms\Get $get): bool =>
153-
is_array($get("config.{$type}")) && in_array('array', $get("config.{$type}")) ||
152+
->visible(
153+
fn (Forms\Get $get): bool => is_array($get("config.{$type}")) && in_array('array', $get("config.{$type}")) ||
154154
$get("config.{$type}") === 'array'
155155
)
156-
->required(fn (Forms\Get $get): bool =>
157-
is_array($get("config.{$type}")) && in_array('array', $get("config.{$type}")) ||
156+
->required(
157+
fn (Forms\Get $get): bool => is_array($get("config.{$type}")) && in_array('array', $get("config.{$type}")) ||
158158
$get("config.{$type}") === 'array'
159159
),
160160
// Relationship options
@@ -204,8 +204,8 @@ protected function selectableValuesFormFields(string $type, string $label, strin
204204
->toArray();
205205
})
206206
->noSearchResultsMessage(__('No types found'))
207-
->required(fn (Forms\Get $get): bool =>
208-
is_array($get("../../config.{$type}")) && in_array('relationship', $get("../../config.{$type}")) ||
207+
->required(
208+
fn (Forms\Get $get): bool => is_array($get("../../config.{$type}")) && in_array('relationship', $get("../../config.{$type}")) ||
209209
$get("../../config.{$type}") === 'relationship'
210210
),
211211
Forms\Components\Select::make('relationValue')
@@ -218,8 +218,8 @@ protected function selectableValuesFormFields(string $type, string $label, strin
218218
Forms\Components\Hidden::make('relationKey')
219219
->default('ulid')
220220
->label(__('Key'))
221-
->required(fn (Forms\Get $get): bool =>
222-
is_array($get("../../config.{$type}")) && in_array('relationship', $get("../../config.{$type}")) ||
221+
->required(
222+
fn (Forms\Get $get): bool => is_array($get("../../config.{$type}")) && in_array('relationship', $get("../../config.{$type}")) ||
223223
$get("../../config.{$type}") === 'relationship'
224224
),
225225
Forms\Components\Repeater::make('relationValue_filters')
@@ -274,8 +274,8 @@ protected function selectableValuesFormFields(string $type, string $label, strin
274274
->columnSpanFull(),
275275
]),
276276
])
277-
->visible(fn (Forms\Get $get): bool =>
278-
is_array($get("config.{$type}")) && in_array('relationship', $get("config.{$type}")) ||
277+
->visible(
278+
fn (Forms\Get $get): bool => is_array($get("config.{$type}")) && in_array('relationship', $get("config.{$type}")) ||
279279
$get("config.{$type}") === 'relationship'
280280
)
281281
->columnSpanFull(),

0 commit comments

Comments
 (0)