Mark
Mark
FFilament
Created by Mark on 12/22/2023 in #❓┊help
Undefined variable $canSelectPlaceholder using Select in Custom Field
I'm probably doing it wrong, but I'm sure someone else will manage to do it wrong the same way. I have created a custom field, based on the KeyValue field, but it allows for an additional piece of information to be entered - the type of data being wrapped in the KVP. Eventually, when dehydrating / hydrating the data, it'll be serialized to JSON. I've tried a bunch of different ways of trying to pass in the canSelectPlaceholder variable, and this is the latest iteration:
<td class="w-1/3 p-0">
<x-filament-forms::select
x-model="row.fieldType"
:disabled="(! $canEditFieldTypes()) || $isDisabled"
:canSelectPlaceholder="$canSelectPlaceholder()"
:attributes="
\Filament\Support\prepare_inherited_attributes(
new \Illuminate\View\ComponentAttributeBag([
'x-on:input.debounce.' . ($debounce ?? '500ms') => 'updateState',
])
)
"
class="font-mono"
>
@foreach ($getFieldTypes() as $fieldType => $fieldTypeLabel)
<option value="{{ $fieldType }}">{{ $fieldTypeLabel }}</option>
@endforeach
</x-filament-forms::select>
</td>
<td class="w-1/3 p-0">
<x-filament-forms::select
x-model="row.fieldType"
:disabled="(! $canEditFieldTypes()) || $isDisabled"
:canSelectPlaceholder="$canSelectPlaceholder()"
:attributes="
\Filament\Support\prepare_inherited_attributes(
new \Illuminate\View\ComponentAttributeBag([
'x-on:input.debounce.' . ($debounce ?? '500ms') => 'updateState',
])
)
"
class="font-mono"
>
@foreach ($getFieldTypes() as $fieldType => $fieldTypeLabel)
<option value="{{ $fieldType }}">{{ $fieldTypeLabel }}</option>
@endforeach
</x-filament-forms::select>
</td>
2 replies
FFilament
Created by Mark on 8/16/2023 in #❓┊help
Rendering a component before the user menu on the header
I don't know what I did wrong here, but I created a ServiceProvider that does the folliwing in the boot() method:
Filament::registerRenderHook(
'user-menu.start',
static fn (): string => Blade::render("<x-team-switcher>")
);
Filament::registerRenderHook(
'user-menu.start',
static fn (): string => Blade::render("<x-team-switcher>")
);
The components are standard components that were created through php arsisan make:component TeamSwitcher
12 replies