In my plugin I need to create a fieldtype of a dropdown, radiobutton or checkbox combined with a textfield.

I've gone ahead and created a custom field type using the description here https://craftcms.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use

Now I'm trying to save the field to the database using the saveField function, but it gives me the following error:

Fatal error: Call to a member function prepSettings() on null in dev/craft/app/services/FieldsService.php on line 503

It seems to fail because $field->getFieldType() returns null, which is weird because $field->type returns the name of my custom fieldtype.

I went deep into Craft code and ended in getComponentByTypeAndClass, where $pluginHandle is the name of my custom field type, instead of the name of my plugin.

Could that be the issue? If not, what could?

Thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.