At admin/structure/book you get a list of books with the option to 'Edit order and titles'. If you click this for an unpublished book, the child pages do not display in the list regardless of whether they are published or not. Additionally, unpublished child pages don't display even if their parent is published.
Steps to reproduce:
- Install Drupal
- Enable book module
- Create a book page, unpublished
- Create a child book page of this (published or unpublished - doesn't matter)
- Create a book page, published
- Create a child book page of this, published
- Go to admin/structure/book
- Click 'Edit order and titles' for the published book, confirm you can see the child page
- Click 'Edit order and titles' for the unpublished book, confirm you cannot see the child page
- Further, unpublish the child created in #6
- Click 'Edit order and titles' for the published book, confirm you can no longer see the child page now that it is unpublished
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | 1184692-43.patch | 1.25 KB | anchal_gupta |
| #43 | Interdiff-1184692-27_43.txt | 1.25 KB | anchal_gupta |
| #27 | list-of-books-unpublished-nodes-1184692-27.patch | 2.09 KB | ramya balasubramanian |
Comments
Comment #1
-enzo- commentedHello guys
I just created a new patch to solve this feature requested.
Please test and let me know if works for you.
Comment #2
estebanvalerio.h commentedReviwed on drupal contribute Costa Rica
Comment #3
Anonymous (not verified) commented#1: list-publish-unpublish-books-1184692-0.patch queued for re-testing.
Comment #4
develcuy commentedgood to go, let's add a nice unit test to the patch :)
Comment #5
yoroy commentedThanks for working on this. A screenshot would help: how can I see if a book is published or not?
Comment #6
kscheirerNeeds some minor code style cleanup, spaces between commas in arrays, spaces between ternary operator, and don't just comment out the old code, remove it.
Comment #7
develcuy commentedCode styling improvements.
Comment #9
-enzo- commented#7: list-publish-unpublish-books-1184692-7.patch queued for re-testing.
Comment #11
Anonymous (not verified) commentedok guys. I just do the patch again, because the last version was broken.
In this case, I'll attach an screenshot that you can see the list of books (all) and your respective status
Comment #12
-enzo- commentedComment #21
ptmkenny commentedComment #22
ramya balasubramanian commentedComment #23
ramya balasubramanian commentedHi @wjaspers, @ptmkenny,
I have checked this issue still exists in 9.1 dev. So I have created the patch and added screenshots before and after the patch. Please have a look and let me know if there are any issues.
Before Patch:
See the Book and parent item of the node
After Patch:
Comment #24
sharma.amitt16 commented@ramya thanks for the patch and it is working fine. Would you please add a status column on the page as already done in previous patches.
Comment #25
ramya balasubramanian commentedHi @sharma.amitt16,
I have addressed your above comments. Please have a look.
After Patch:
Comment #26
sharma.amitt16 commented@ramya thanks for the change. Small correction, would you please move the operations column after status.
This is not consistent with other content listing with operations.
Comment #27
ramya balasubramanian commentedHi @sharma.amitt16,
Updated the patch and screenshots.
Comment #28
sharma.amitt16 commentedNow looks good.
Comment #29
priyanka.sahni commentedComment #30
priyanka.sahni commentedVerified and tested by applying the patch #27.It looks good to me.Can be moved to RTBC.
Steps to test -
1. Go to admin site.
2. Go to admin/modules , enable the book module.
3. Go to admin/content.
4. Create 2-3 book content type.
5. Create one of them in unpublished state and other in published state.
6. Go to admin/structure/book.
7. Verify the listing.
Before Patch -

After Patch -

Comment #31
priyanka.sahni commentedComment #32
kscheirerBased on #30.
Comment #33
priyanka.sahni commentedComment #34
catchDo we need to check that the current user has access to view unpublished nodes? What's the route access for this page?
Also there's no test coverage added with this patch but probably should be.
Comment #35
ramya balasubramanian commentedHi @catch,
Thanks. Sorry for the delayed reply. I have checked your comment and already there is one issue related to access to unpublished nodes (https://www.drupal.org/project/drupal/issues/26552). And in this issue https://www.drupal.org/project/drupal/issues/26552, in the last updated patch(https://www.drupal.org/files/issues/2020-03-18/26552-156.patch) they have added test cases for listing book pages testAdminBookListing, testAdminBookNodeListing.
Is this enough or do we need to create seperate test cases for this issue also? Please let me know.
Comment #36
pameeela commentedUpdated title and issue summary - admin/content/book does not seem to exist, I worked out what is going on though :)
Changing to a bug, not a feature request as there is no reason this shouldn't work for unpublished content.
Comment #42
andypostUse $this->nodeStorage->load() instead
Overall not sure it's needed but
- no reason to duplicate status column
- strings should use $this->t() to be translatabe
Comment #43
anchal_gupta commentedI have uploaded the patch.
Addressed #42 both points,
Rerolled against 10.1x
Comment #44
mstrelan commentedI cannot reproduce this on 10.1 following the steps in the issue summary. It might be worth noting that I was logged in as user 1, do we need to use a certain role with certain permissions. Can someone who can reproduce this please provide updated steps to reproduce?
Furthermore we need a failing test to confirm this behaviour.
Comment #45
quietone commentedI tested this on Drupal 10.1.x, standard install. I used the steps in the Issue Summary. First, I tested with the admin user and I was not able to reproduce the problem. Next, I created a user that had permission to create books, edit own books, administer content, view own unpublished content and the necessary admin book permissions. Again, I could not produce the error.
This may have been fixed as part of #26552: Allow users with access to unpublished nodes to create unpublished books but #21 and the testing just after suggests otherwise.
Therefore, closing as outdated. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!