0

I need to build a user data structure that includes child entities.

I've got a custom module that defines a child entity to the user object. When i add the entity reference to the user in the CMS back-end I get the options of autocomplete/checkboxes, but I'd like to have the form instead that will allow you to either add new content for the child entities or update existing ones.

This would need to be on the default user registration form as well.

I'm currently looking at Entity form render and if i can use that some how to render the form elements for the entities.

Side note: they can have up to N reference entities when they register. so it has to be repeatable as well.

Edit I've attempted to do this through extending the UserRegisterForm class supplied in Drupal core but this didn't address the issue of creating a repeatable field and I couldn't figure out how to easily pull in the form elements for the Entity I created. I started looking into the Entity Form render methods mention on here as mentioned above to try and address this for the the inline_entity_form module was suggested.

I was also looking into doing a complete stand alone HTML build of the registration form then using the REST module to submit the data via an AJAX request as i would of then been able to re-use this component in the account section with some edits to enable the auto population.

  • Welcome to Drupal Answers! We love to help you but we only have your wish list but we don't know what exactly you've tried yourself so far and where exactly you are stuck. Please see How do I ask a good question and update your question accordingly. Thank you – leymannx Apr 4 at 11:39
  • Maybe try drupal.org/project/inline_entity_form – leymannx Apr 4 at 11:39
  • 1
    @leymannx - Thank you for the module suggestion, I may have come across this in my search but skipped by due to the non "stable" nature of the module, but as you suggested it, I installed it with my module and it's currently achieving what I require. Also updated my question with explored paths prior to submitting this question to show other potential paths. – irn3rd Apr 4 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.