waffl
August 18, 2018, 4:50pm
1
I’m trying to learn how to build a plugin for Kirby, in particular for a custom field, and am running into an error when loading the panel:
The field class is missing for: …
I was wondering how to go about debugging this? I’m looking at a number of existing plugins for reference and am not sure what this is referring to?
This error can occur in two circumstances, do you have a line number for me?
waffl
August 18, 2018, 5:07pm
3
Ah it is /panel/app/src/panel/form/plugins.php:59
Maybe. a typo somewhere, did you name your field exactly like the file?
If you post your code, it would probably make things easier.
waffl
August 18, 2018, 7:21pm
5
Thank you for the response - the code is just so rough as it’s early on, but after trying so many different versions of naming things, I re-read the documentation on custom fields and realized far too late that the class name itself, by convention requires it to end with ‘Field’:
https://getkirby.com/docs/developer-guide/panel/fields#anatomy-of-a-field-folder
phone /site/fields/phone/phone.php class PhoneField {}
So I think that was the issue all along, not the folder structure I had been using, and it is working now!
That said, I’m not really sure how things with hyphens/dashes in the name work, as I can only seem to get things working without any dashes.
Yes, that was the issue then. You can‘t have dashes in your class name.
1 Like