EDIT: I want link button in an edit form of a content type like 'store' that says 'add store section'. This link/button should directly go to the edit form that adds a new 'store section' which is pre-configure by me as entity reference. This link would be next to a drop-down list of already available 'store sections'.

First step would be that the link needs to go to the node/add form of contenttypeB. I've heard as a hint that hook_field() functions are what I need. Something would have to get the form id somehow and this is where I'm confused, I'm wondering if I need to address the contenttypeB nodeforms hardcoded into my .module file? Or do I just need to start doing this by looping through all the fields of the content types and checking whether those fields are an entity reference and then apply it?

I'm still very scared of module development and php as I can stare at code for too long. I'm sort of getting the hook concept a little bit now. Things like hook_men() and then how it goes to the callback function I sortof get. Or when it can go to drup_get_form() and you fill in the function to build a form, I can dig that.

Just to say what level I'm at.


This could be done without a custom module, by using the Markup module.

However, if you are looking for the ability to add a new ContentTypeB that is immediately referenced, the References Dialog module can do this.

  • The References Dialog is almost perfect. The only problem is that it's confusing for content authors that have no affinity with computers whatsoever. The parent-child terminology is going to mess with their heads too much.
    – Immers
    Jun 20 '12 at 14:21
  • That doesn't sound familiar. We have a site where doctors add their information, including a location (a nodereference). In the field settings, "Add dialog" is checked, which provides a simple "Add Location" link next to the Location autocomplete form. It's very simple and user-friendly, with no reference to parent/child.
    – keva
    Jun 20 '12 at 15:09
  • I'd be happy to go ahead and learn a bit about this module but I can't find any resource on how it works. All I could find so far is <a href='youtube.com/watch?v=nE80F-jvknU'>this youtube film</a>. I came up with the parent/child thing after watching this. Can't say it's from my own experience because I can't find any 'add dialog' checkbox in my field settings afer enabling the module. I googled the module and found nothing except for that little youtube film. plus I didn't find a readme.txt in the module.
    – Immers
    Jun 21 '12 at 8:05
  • The module worked automatically for me, but tha tmay be because I had the widget set up as Autocomplete. This issue may help you: drupal.org/node/1491576
    – keva
    Jun 21 '12 at 15:05
  • That was very helpful and seems to work very well now. Awesome. Cheers!
    – Immers
    Jun 22 '12 at 7:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.