jbenavidesv
jbenavidesv
FFilament
Created by jbenavidesv on 2/1/2024 in #❓┊help
`statePath` and `visible` nested components not working together
I have something like this:
$array_of_things = ['1', '2', '3'];
$array_of_components = [];
foreach ($array_of_things as $a) {
array_push(
$array_of_components,
Select::make($a)->options([
'what' => 'what',
'ever' => 'ever',
'et' => 'cetera',
])->multiple()->visible(function (Get $get) use ($a) {
return $get('componentX') == $a;
})
);
}

// ...

return $form
->schema([
Select::make('componentX')->options([
'1' => '1',
'2' => '2',
'3' => '3'
])->dehydrated(false)->live(), // This activates a component from $array_of_components
Group::make('does_not_matter')->schema($array_of_components)->statePath('someAttribute'),
]);
$array_of_things = ['1', '2', '3'];
$array_of_components = [];
foreach ($array_of_things as $a) {
array_push(
$array_of_components,
Select::make($a)->options([
'what' => 'what',
'ever' => 'ever',
'et' => 'cetera',
])->multiple()->visible(function (Get $get) use ($a) {
return $get('componentX') == $a;
})
);
}

// ...

return $form
->schema([
Select::make('componentX')->options([
'1' => '1',
'2' => '2',
'3' => '3'
])->dehydrated(false)->live(), // This activates a component from $array_of_components
Group::make('does_not_matter')->schema($array_of_components)->statePath('someAttribute'),
]);
In the database, I have a table with a JSON column called someAttribute. The idea is that the column saves the JSON dictionary of the components. Something like:
{{'1' : 'what'}, {'3' : 'ever'}}
{{'1' : 'what'}, {'3' : 'ever'}}
But, when using statePath, the components are not showing. When statePath is removed, the components do show, but are not registered as a dictionary and instead only the last modified component get saved.
1 replies
FFilament
Created by jbenavidesv on 9/27/2023 in #❓┊help
minimal theme
The filament v3 plugin discord link for minimal theme is broken. Where can I ask about it?
5 replies