I created a custom module for Drupal 8 that allows the users to choose a Content type in order to add some fields programmatically.
How I can create some fields (text type in this case) and attach they to a Content type with a custom module?
Some help?
Thanks.
Best Answer
Checkout Field API for Drupal 8
It has several functions implemented and hook_entity_bundle_field_info might be what you need, here is an example of textfield from the docs of that hook
You might also need Field Storage, checkout hook_entity_field_storage_info