0

I need to create structure [taxonomy_term] Author -> [taxonomy_term] Book -> [node] Quote.
I already have the following structure: [taxonomy_term] "Author name and Book name" -> [node] "Quote". Now I want to split vocabulary "Author name and Book name" into 2 different vocabularies: "Author" and "Book" and link them to each other and to node type "Quote" to get the following hierarchy:

  • Author [taxonomy_term]
    • Book [taxonomy_term]
      • Quote [node]
      • Quote [node]
    • Book [taxonomy_term]
      • Quote [node]
      • Quote [node]

I can create this hierarchy using Entity reference, but I don't know how to achieve the following.

On node (Quote) creation user should be able to:

  • choose existing "Author" term and existing "Book" term that belongs to this Author (conditional select);
  • choose existing "Author" term and create new "Book" term (and link this book to "Author" term);
  • create new "Author" and "Book" terms (using taxonomy autocomplete widget) and link them to each other.

Is there any way to achieve this using existing Drupal modules?

Please note: I need to use 2 different vocabularies for authors and books. I know that it would be much easier to use 1 vocabulary and parent-child hierarchy of terms, but that is not suitable in my case.

  • what community modules have you already researched ? – tenken Jun 12 '14 at 20:08
  • Entity Reference (base module for my goal), Field collection (does not seem to be useful in my case), Corresponding Entity References (this module not working and seems to be broken for now) – quotesBro Jun 12 '14 at 20:22
  • I'm starting to think that I will have to write custom module for my needs, and use hook_node_presave() to make references between terms programmaticaly. – quotesBro Jun 12 '14 at 20:45
1

Complex business like this is hard "out of the box" with Drupal. Everyones custom logic like you've listed is different -- so community modules regularly dont let you define just deep nesting of logic.

I suspect you'll have to create some custom code to enforce relationships you want (form validation logic).

Additionally, look at Conditional Fields, Entity Inline Form and perhaps the Prepopulate module.

You can use these modules to build the dependant drop down select lists, and a button to create the Book or Author for a quote as needed -- the prepopulate module could let you pass info from a book or author on creation, to the reference entity.

You may want to look at Display Suite or Renderable Elements to tweak how the node form(s) are layed out.

As I said this isn't a solution but tools to help you build your own business-logic solution.

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.