Answers.Body: <p>I've given up on this, from what I've looked at it's not going to be easy without a migration that creates the fields first (don't really want to do this for updatability issues). I've changed the scope of the plugin to be more bare-bones, and I think it's better for it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-27T10:17:04.293Z
Answers.LastActivityDate: 2020-10-27T10:17:04.293Z
Answers.UserDisplayName: dmatthams
Body: <p>I've created an element type and want to have a 'Categories' and 'Tags' field built-in (the sources for each will be selectable in settings), but can't figure out the best way to go about this whilst supporting custom field layouts with tabs.</p>
  <p>Do I just hard-code these fields into the edit page/hud html code then handle the logic on the save controller (this is fiddly whilst keeping it customisable/tab-able), or is there a better way to do it? I.e inject them into the field layout via the controller?</p>
  <p>Can't get my head around this one.</p>
  
Tags: <plugin-development><elementtype>
Title: Element type with 'baked-in' fields
ThreadText: # Element type with 'baked-in' fields
  
  (Asked by: username_0 on 2020-10-21)
  
  I've created an element type and want to have a 'Categories' and 'Tags' field built-in (the sources for each will be selectable in settings), but can't figure out the best way to go about this whilst supporting custom field layouts with tabs.
  
  Do I just hard-code these fields into the edit page/hud html code then handle the logic on the save controller (this is fiddly whilst keeping it customisable/tab-able), or is there a better way to do it? I.e inject them into the field layout via the controller?
  
  Can't get my head around this one.
  
  **Tags:** plugin-development, elementtype
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-10-27. Score: 2 | Accepted answer
  
  I've given up on this, from what I've looked at it's not going to be easy without a migration that creates the fields first (don't really want to do this for updatability issues). I've changed the scope of the plugin to be more bare-bones, and I think it's better for it.
  
  
  ---
  
  