0

I created custom entity, added basefields in class and now I want to add fields. I know I could add them with UI but wondering how to do that with code. Is the proper way to add .yml files in config/install and when module is installed this config should be too or do I need to use hooks to add fields and .yml part doesnt work in this cases?

3
  • If the fields are important enough to come with the module, is there are particular reason you've chosen not to implement them as base fields?
    – Clive
    Sep 13, 2018 at 12:14
  • 1
    Yes, the main reason for creating custom entity types is to define exactly what you need as base field. Anything that can be a configurable field can be a base field too. Other than that you also already answered your own question, fields, like any other configuration, would be added to config/install, yes.
    – Berdir
    Sep 13, 2018 at 22:29
  • @Clive there is no reason, I am doing this for learning purposes and what can and can't be done.
    – Blissful
    Sep 14, 2018 at 7:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.