Body: <p>I'm working on a plugin that would require a custom element to have a hierarchy, as in, possibly have a parent set or not. Much like entries have when used in a structure. </p>
  
  <p>I've got my element set up and all the custom fields and the title get saved just fine, however I've hit a wall trying to get them have a parent. </p>
  
  <p>I've tried setting the parent property to another element and after I hit save, it does not seem to properly register it. </p>
  
  <p>Is there a specific way to go about this? The documentation is rather sparse on implementing a hierarchical custom element. </p>
  
  <p>Any pointers or examples on how to implement this would be greatly appreciated. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-16T02:48:18.810Z
Comments.Text: Maybe check the source code of Categories?
Comments.UserDisplayName: Parry Huang
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-18T16:37:12.083Z
Comments.Text: Would love to know if there's more info on this now!
Comments.UserDisplayName: strandall
Tags: <plugin-development><craft3>
Title: Custom element from plugin in structure-like hierarchy
ThreadText: # Custom element from plugin in structure-like hierarchy
  
  (Asked by: username_0 on 2019-07-12)
  
  I'm working on a plugin that would require a custom element to have a hierarchy, as in, possibly have a parent set or not. Much like entries have when used in a structure.
  
  I've got my element set up and all the custom fields and the title get saved just fine, however I've hit a wall trying to get them have a parent.
  
  I've tried setting the parent property to another element and after I hit save, it does not seem to properly register it.
  
  Is there a specific way to go about this? The documentation is rather sparse on implementing a hierarchical custom element.
  
  Any pointers or examples on how to implement this would be greatly appreciated.
  
  **Tags:** plugin-development, craft3
  
  > **Comments:**
  > **username_1**: Maybe check the source code of Categories?  
  > **username_2**: Would love to know if there's more info on this now!  
  
  ---
  
  ## 0 answers
  
  