I enabled the Book module, but there is no "Book page" content type.

I am using an administrator account with all permissions turned on.

"Add content" (node/add) does not list it, nor does "Content types" (admin/structure/types).

Going directly to node/add/book doesn't work.

The content type is not in the Navigation menu navigation configuration (admin/structure/menu/manage/navigation), although there is a "Books" menu item I can enable.

It does appear in the {node_type} table.

The usual content type permissions do not appear for "Book page", although the four special "Book" management permissions are there.

The Book configuration pages (admin/content/book) pages do appear. I set "Content types allowed in book outlines" to "Basic page" and "Content type for child pages" also to "Basic page".

Disabling, un-installing, and re-installing the module doesn't help.

Clearing the caches doesn't help.

In short, the content type is in the database, but doesn't appear anywhere on the Web site.

Comments

DanZ’s picture

Issue summary: View changes

Mention permissions.

DanZ’s picture

Title: "Book page" content type doesn't appear » "Book page" content type conflicts are destructive and otherwise vexing
Version: 7.19 » 8.x-dev

I managed to troubleshoot this and get it working. Before I did, the module destroyed my site, and then refused to work after I restored it. There is a lot of room for improvement in the way the Book module handles its content type.

It's related to #1741718: You can't reuse a node_type's machine name after renaming it. There's more to it, though. Here's the full story:

I originally had an Ubercart product type called "book", because my site is a Web store that sells books.

I enabled the Book module, because I didn't know that it set up a new "book" node content type (there is no warning of this). This destroyed the Ubercart installation, since all my book product nodes no longer worked.

By some miracle, I had made a database backup immediately before enabling the Book module. I almost didn't, because I couldn't imagine any harm in enabling a Drupal core module. I restored the backup and Ubercart started working again. I knew that it was the Book module that broke my site.

After much experimenting, I determined that the Book module set up a new "Book page" content type with the "book" machine name. I changed the machine name of the Ubercart product node type to "uc_book", and enabled the Book module. Now Ubercart worked, but the "Book page" content type still didn't appear.

I eventually solved the problem for my site by digging into the DB tables. I discovered that the entry for "uc_book" in the {node_type} table had a field called "orig_type", and this still contained "book". I changed the orig_type value to uc_book, uninstalled the Book module, then reinstalled it, and the problem went away.

Needless to say, this is an unreasonable amount of trouble to come from a Core module. Solving #1741718: You can't reuse a node_type's machine name after renaming it. will help, but the Book module could do a lot to avoid these problems. Some suggestions:

Change the content type name.
"Book" is a common English word for a common object, and this problem is surely going to bite other unsuspecting Web admins who have sites that deal with books. Instead of "book", use a machine name like "book_page" or "book_index_page". This change might not be reasonable for D7 for fear of breaking lots of things, but could go into D8.
Dynamically choose a name to avoid conflict.
On install, if "book" is already taken, choose "book_1" (etc.) as a content type machine name, instead. Use the "module" field of {node_type} to determine if it was established by a previous install of the Book module, or by a different module. Write a book_content_name() function to return that name (which will probably just be in a system variable), so other modules can interact with it.
Detect and flag the problem.
If there's a conflict, instead of quietly failing to work or destroying another module's content, put up an error message. This could go into the config page at admin/content/book/settings or, better yet, as a system message and a check on the status report at admin/reports/status.
DanZ’s picture

Issue summary: View changes

node/add/book doesn't work.

rootwork’s picture

Title: "Book page" content type conflicts are destructive and otherwise vexing » Change book module's content type machine name, and/or warn about conflicts
Issue summary: View changes

This is still an issue, and still seems like an easy fix -- at the very least, we could rename the "book" machine name to "book_page" as DanZ suggested. His second and/or third options would be even better, of course.

Lots of Drupal Commerce sites sell books. Although I'm not a huge fan of the book module anyway, it shouldn't go around destroying other content types if we can help it.

Dan, while I love your original title, I'm changing it for clarity and to see if we can get any love for this a couple of years after you first suggested it.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dpi’s picture

Status: Active » Closed (won't fix)

Can no longer repro

nor does "Content types" (admin/structure/types).

It is visible to me. node.type.book is now optional config.

rootwork’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Closed (won't fix) » Closed (cannot reproduce)

Correcting the reason for closing.

This may still be current in 8.3.x. @dpi the problem wasn't that the book content type doesn't show up when the module was enabled, it's that it doesn't show up when a content type already exists with the machine `book`.

Here's what happens now:

If, when the book module is enabled, a content type with the machine name `book` already exists, the book module essentially "takes over" that content type. Book settings are automatically applied to that content type (book settings can be applied to any type, but they are set automatically here). However, it does not seem to a) modify the existing fields on the content type, or b) prevent access to existing nodes of that content type.

If this is expected behavior, then this is accurately closed, since it no longer breaks the site or causes a loss of data.

Personally I think book module should create a new content type, with a new name, and inform the user that it has done so. But in terms of fixing the critical error, it's true it no longer exists.