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?
-
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
-
1Yes, 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.– BerdirSep 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.– BlissfulSep 14, 2018 at 7:15
Add a comment
|