FilamentF
Filament2y ago
Mark

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>
Was this page helpful?