I’m creating a custom field type by following this guide. Now, I want to add some customization to the field by providing similar “options” as the TextOption field, where you can add your own options to the dropdown with a label and a value.
How do I do this for my custom field? The IEditFieldTypeConverter class contains a function, “CreateOptionsModel”, which I guess has something to do with it, but there’s no documentation what to do with this function or if its the right one.
I found some ancient examples where new TextOption(); was returned in the CreateOptionsModel() which partially works. The “options” collapsible is now visible in the backoffice when configuring the field. However, it looks like I have to rebuild the whole “TextOption” options view?
When inspecting the html code of normal TextOption field when configuring it, I can see that a directive is used, field-editor-text-option-setting, but there’s no documentation for this as well.
I created a plain angular component and included it in the “declarations” array in the extensions.ts file, and then set the name of SettingsComponentName to Accelerator#TestSettings which showed the settings component. But, I’d rather not rebuild the TextOption settings view, if possible.
Yes, keys and translations can be added to the resource files in the Accelerator to use translated strings in your field component. You can see in the FilterField from the Accelerator: