0

I'd like to create a book in my Drupal site but I chose to do that manually, without using the Book module so I won't be limited by its options.

Thus, I first created a new content-type named "book_pages" and then I gave it a long text field with summary ("body"), and I need a second field-type for paging, but I'm not sure what its field-type should be:

It should automatically include the node order-number** so that if the node is the fifth node of the content-type a user would see the following, when visiting the fifth book_page:

text (body)
5 (page-number)

What field-type should I choose?

closed as primarily opinion-based by leymannx, Alfred Armstrong, mradcliffe, Neograph734, Felix Eve Sep 7 '18 at 7:23

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

1

This question relies heavily on the assumption that you will only ever have one book on your site. Nothing wrong with that, it's just good to emphasize it.

NIDs aren't a good option because they leave a gap in numbering if a node gets deleted.

What you want is the Serial Field. There is only a dev version for D8: https://www.drupal.org/project/serial/releases/8.x-1.x-dev, Porting tracker: https://www.drupal.org/project/contrib_tracker/issues/2767507

This Field doesn't show up on the Create/Edit node form, because it's automatic, but it does display the number on View node.


In case you ever want to add more books to your site but not use Books module here's my answer on how to recreate the functionality: How to create a book without the book module (say, with Views)?

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