Is it possible to modify state of KeyValue before filling?

I have the following Form element to handle some translations in a key-value component but I need to add some missing keys, e.g. title is array of ['en' => 'test'] but I would like user to be able to also input de language. How can I modify a state of the component so I would also include a missing de key with an empty value.
Forms\Components\KeyValue::make('title')
->disableEditingKeys()
->disableDeletingRows()
->disableAddingRows()
->keyLabel('Language')
->valueLabel('Text')
->required()
Forms\Components\KeyValue::make('title')
->disableEditingKeys()
->disableDeletingRows()
->disableAddingRows()
->keyLabel('Language')
->valueLabel('Text')
->required()
3 Replies
Dan Harrin
Dan Harrin2y ago
maybe just create a simple custom field for this would probably work better than hacking the keyvalue to work exactly as you want
Crylar
CrylarOP2y ago
Hm, I think I am on something but not sure if this is the right method to use. I am not sure if this will not break something else but visually looks something that I wanted.
Dan Harrin
Dan Harrin2y ago
could work, yes
Want results from more Discord servers?
Add your server