Score:0

New node of content type always as new book

jp flag

I have two content types: my-book and my-page.

Is it possible to automatically create a new book (using the Book module) when a my-book node is created?

I was looking into using hook_node_presave(), but this doesn't give a node ID to use. Using hook_entity_insert() doesn't permit to change the field values for the newly created node.

Jaypan avatar
de flag
I don't think I understand, if you make a new book every time a new book page is created, every page will only belong to that single book, leaving me not clear on what the purpose is of creating a book.
Joost avatar
jp flag
Only when a new node of content type *my-book* is created it will create a new book. This will be the top level book page. The *my-page* node will be added as child to this book.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.