I need to be able to add a list of departments to an entity directly via the add form of that entity. Those departments don't necessarily exist in the application beforehand and could be strings or entities (being desperate, I've tried both, but entities would of course be the better choice here).

I first thought the map field type would be ideal for such a case, but couldn't find a way to display it in my form, since I couldn't find an example in the documentation.

I thought this would be fairly easy, but it doesn't look like it. Then again, maybe it's because I've only been using Drupal for a little more than a week.

  • 1
    You're looking for Inline Entity Form (assuming you're looking for an entity reference field, there's no such thing as an entity reference field that could also accept a string, the types of data are incompatible), I don't believe it's been ported to Drupal 8 yet. For a list of strings you can just use the text field included with core, or taxonomy tags might make more sense – Clive Mar 4 '15 at 9:54
  • That indeed looks like it's exactly what I need. While waiting for it to be ported, I guess I should head towards the string list solution, since I need this rather quickly. I'm still stuck on that part too, however. Any ideas? – PLPeeters Mar 4 '15 at 9:59
  • Not closing as duplicate as you are asking it in a different way, but have a look at drupal.stackexchange.com/questions/149480/… – Berdir Mar 5 '15 at 9:11

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.