I have two content type I selected as book content type: Text_book_type and audio_book_type.

Now, I need that these content have different child content type:

chapter_type for text_book_type and audio_chapter_type for audio_book_type.

Is there a way in Drupal 8 to achieve this?


Yes you can create two different Content types for your chapter nodes, just like you have different Content types for your book nodes.

The "Parent-Child" relationship you describe is usually accomplished with Entity references.

Add Entity reference fields to your chapter_type and audio_chapter-type and configure them to reference text_book_type and audio_book_type nodes respectively.

Then when creating a chapter node you'll be able to choose which book node it belongs to.

You can use Views to list all child nodes on a book page through that reference field, if you need such a list.

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.