Closed mrhappyheart closed 1 week ago
dirty solution : edit all the files and use this structure :
public static function getOptions(?array $sections = null): array
{
$options = [
Accordion::make('general-options')
->label(__('General Options'))
->icon('iconpark-checklist-o')
->schema([
\Filament\Forms\Components\Toggle::make('options.allow_multiple')->label(__('Allow Multiple')),
self::required(),
self::columnSpanFull(),
self::htmlID(),
]),
self::hintOptions(),
self::visibility($sections),
];
if($ins = Bolt::getCustomSchema('field', resolve(static::class))) {
$options[] = $ins;
}
return [
Accordions::make('check-list-options')
->accordions([
...$options,
]),
];
}
standard solution : adding "..." to first of line
public static function getOptions(?array $sections = null): array
{
return [
Accordions::make('check-list-options')
->accordions([
Accordion::make('general-options')
->label(__('General Options'))
->icon('iconpark-checklist-o')
->schema([
\Filament\Forms\Components\Toggle::make('options.allow_multiple')->label(__('Allow Multiple')),
self::required(),
self::columnSpanFull(),
self::htmlID(),
]),
self::hintOptions(),
self::visibility($sections),
...Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
]),
];
}
this looks similar to #294. can you make sure you have the last version of bolt and accordion packages
you can run php artisan about --only=zeus
yes it's latest even on github you can find the problem like : https://github.com/lara-zeus/bolt/blob/3.x/src/Fields/Classes/CheckboxList.php
and output:
accordion ................................................................................................ 1.1.3
bolt ................................................................................................... v3.0.60
bolt-pro ................................................................................................ v3.2.1
core .................................................................................................... v3.1.9
matrix-choice ........................................................................................... v3.2.1
sky ..................................................................................................... v3.4.9
I cant reproduce the issue, the demo is working fine :)
I test it with/without Bolt pro I test it with/without Grades I test it with/without Custom Schema
try update bolt pro: bolt-pro ................... v3.2.1 => v3.2.12
and as I explained about the ...
:
I need the 3 dots here:
...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [],
coz the GradeOptions::schema
will return array so I need the ...
to append it to the accordions
array and it will filtered in the accordions
method.
I dont need the dots here:
Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
coz the getCustomSchema
will return Accordion::make
so adding ...
will break if you use Custom Schema, otherwise it will return empty array and will be filtered in the accordions method
i think the problem is coming from Facede / Bolt file:
public static function getCustomSchema(string $hook, ?FieldsContract $field = null): Tab | Accordion | null
{
$class = BoltPlugin::getSchema($hook);
if ($class !== null) {
$getClass = new $class;
if ($hook === 'form' && $getClass instanceof CustomFormSchema) {
return $getClass->make();
}
if ($getClass instanceof CustomSchema) {
return $getClass->make($field);
}
}
return null;
}
it returns null for me
tested on new app and 'zeus` starter kit and the demo app I test it with/without Bolt pro I test it with/without Grades I test it with/without Custom Schema
feel free to reopen with a reproduction repository. thank you
What happened?
Filament\Forms\ComponentContainer::Filament\Forms\Concerns{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, array given {"userId":4,"exception":"[object] (TypeError(code: 0): Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given at /home/yallaxom/public_html/vendor/filament/forms/src/Concerns/HasComponents.php:122)
How to reproduce the bug
in most of the fields this line makss problem in codes:
Bolt::getCustomSchema('field', resolve(static::class)) ?? []
example in FileUpload.php (vendor\lara-zeus\bolt\src\Fields\Classes\FileUpload.php)
error :
Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given {"userId":4,"exception":"[object] (TypeError(code: 0): Filament\\Forms\\ComponentContainer::Filament\\Forms\\Concerns\\{closure}(): Argument #1 ($component) must be of type Filament\\Forms\\Components\\Component, null given at /home/yallaxom/public_html/vendor/filament/forms/src/Concerns/HasComponents.php:122)
when you remove the line the problem will be solved
Package Version
3.0.59
PHP Version
8.2.*
Laravel Version
11
Which operating systems does with happen with?
No response
Notes
No response