Original title

Remove the Book module from core

Original description

Why?

The one problem I noticed with my example above is that is doesn't provide any Back/Forward links. However, a small function placed in Views Tree could return the next or previous item.

Relation could probably be used as well, but I'm not sure how far along it is.

Postponed until #267855: Provide an entity hierarchy API is resolved, please contribute to the discuss over on that issue

Comments

Dave Reid’s picture

No.

Damien Tournoud’s picture

Status: Active » Closed (won't fix)

As explained, I want to keep this one, and refactor it, Taxonomy, Menu (and possibly Comment) based on a single "Parent entity" hierarchical field.

colan’s picture

Sorry, I must have missed that in the shuffle. Works for me. :)

scroogie’s picture

Damien: Any starting points? I'd be interested.

good_man’s picture

I'm interested in maintaining book and to keep it in core.

Can we benefit from chx new project Entity Tree

cweagans’s picture

@good_man, book is staying in core, and I think there's already a maintainer (you'd have to check MAINTAINERS.txt to be sure), but your help would certainly be appreciated here: http://drupal.org/project/issues/drupal?text=&status=Open&priorities=All...

good_man’s picture

Yes I think pwolanin is the maintainer, but it needs a serious refactoring, I'll try to catch with him on IRC to talk about this issue.

fuzzy76’s picture

Did anything actually happen on this?

colan’s picture

I think the plan is to go with Tree, but it might be a while before it gets into core.

cweagans’s picture

Huh? Where was that decided?

colan’s picture

I'm not sure it ever was; I'm just trying to read DamZ's mind. ;)

catch’s picture

Version: 8.0.x-dev » 9.x-dev
Issue summary: View changes
Status: Closed (won't fix) » Active

We should revisit this for Drupal 9.

#1627676: Display stats on enabled components (e.g. modules included in a project) would certainly help to understand how much real-world use book module gets.

fuzzy76’s picture

Agreed. No matter how much you simplify and refactor book I would say it is still not a common enough use case to warrant core functionality (and this is coming from someone who works daily on a site that uses book heavily).

What core offers and doesn't offer is still a very weird mix.

dawehner’s picture

When we manage to convert the menu system into a generic tree component, the book module might be a good prove that this tree component is flexible enough for us. Of course this doesn't change the decision whether we want to keep the book module or not, but at least it could be done somehow.

catch’s picture

@dawehner that sounds very similar to #2 from 2011 but agreed if we actually did that it'd be a good test case.

catch’s picture

Project: Drupal core » Drupal core ideas
Version: 9.x-dev »
Component: book.module » Idea
fuzzy76’s picture

OTOH, another way to do this is to implement a general "entity hierarchy" API in core but toss the book-specific interface parts out in contrib land.

Bojhan’s picture

@catch @dawehner Is the plan to wait till 2021 before that happens or rip it out before?

dawehner’s picture

@Bojhan
Well nothing will happen before D9, that's for sure :) But yeah maybe deprecate it, point people to some contrib project and then maybe get that into core or so

Bojhan’s picture

I think that makes more sense for sure.

catch’s picture

@fuzzy76 we already have taxonomy and menu hierarchies in core. Book was refactored in 6.x or 7.x to re-use the menu hierarchy, however that had to be undone at the last minute in 8.x due to routing/menu link changes - so it has its own custom implementation copying the implementation of menu links at the moment.

yoroy’s picture

The feature of having an outliner to manually group a set of content is very useful.
The current ui for it is very much not good. (It sucks)
It sounds like it's carrying around more custom code than it should.

How fair is it to say that the main difference between "book" and "create a menu and add links to your content from there" is getting automatic previous/next links in the case of book? I imagine a menu specific setting to "add prev/next links to content in this menu".

catch’s picture

How fair is it to say that the main difference between "book" and "create a menu and add links to your content from there" is getting automatic previous/next links in the case of book? I imagine a menu specific setting to "add prev/next links to content in this menu".

The only other thing I can think of is the ability to start a book outline from the node form - the equivalent would be a 'new menu' option in the menu selector.

fuzzy76’s picture

@catch re #21, I still think book, menu and taxonomy should use the same entity hierarchy layer. It would simplify all three, and provide an API contrib could use. Unfortunately I don't have free time to donate to the cause. :-/

colan’s picture

To extend what was said in #17, we could make the API work similar to the Entity Revisions API, which can be implemented as per Making an entity revisionable. So we'll have an Entity Hierarchy API, with a Making an entity hierarchical doc page instead.

As far as storage goes, we would need to store a parent ID (at least).

catch's blog post is related: The accumulation of technical debt, or how a recently opened critical core bug is 15 years old refers to #2858431: Book storage and UI is not revision aware, changes to drafts leak into live site.

Neograph734’s picture

I was linked here from #2871733: Remove the book content type from the book module and this issue too proves that there are some issues with the implementation of the book module.

Reading though this issue I agree that it would be nice to have some method for having hierarchical content in core. Book, menu and taxonomy would be perfect candidates for such a system and it might even be useful for another weirdness in Drupal: Too many ways to achieve a link to content.

One of the biggest issues I run into when training new team members is that they cannot oversee the menu system. There are menu links created from within entities (nodes, views, panels, etc) and there are manual links to custom urls. All my new team members follow the logical path, structure > menu > main menu > add menu item and they provide the url to their newly created view, while the older team members created the links from within the view. (This caused a lot of trouble with localization in Drupal 7.)

I realize I am going a bit off topic here, but if there were to come a hierarchy API, could we tackle this as well? I would be very happy to see a method where the 'add menu item' would not only offer an url, but something like an entity reference as well (Since Drupal 8 it appears to be possible to reference nodes from the add menu item form). If node, views, panels, etc. would be able to tap into this system, it might even be possible to create and edit the same menu item from multiple places without issues?

Using such a system would also allow the book, menu and taxonomy structure to be built with the same UI. I like #24 very much.

UPDATE, the menu idea has been proposed as stand alone idea here: #2875183: Rework the menu system to be more entity reference based.

yoroy’s picture

colan’s picture

I just revived #267855: Provide an entity hierarchy API as a Core idea, so how about if we take the API discussion over there, and then postpone this one until that's sorted?

Bojhan’s picture

Status: Active » Postponed (maintainer needs more info)

Makes sense, let do that.

When more information surfaces on that approach lets revisit this.

sakhan’s picture

Simply NO! Please don't ever think of removing Book module from the core! The Book module is the reason for which I have abandoned all other content management systems.

colan’s picture

#30: We're no longer looking at removing the functionality from Drupal, but rather rewriting it so that it uses a standard API, which can be shared by other modules that also depend on hierarchies.

I suppose we could rename this issue, but I'm not sure how to do that without losing the historical meaning.

yoroy’s picture

Title: Remove the Book module from core » Rewrite book module to use a standard, reusable API for creating hierarchies

Something like this? :-)

AaronMcHale’s picture

I'm interested in this, possibly a good starting point that would benefit a lot of people right away would be converting the list of child pages on book nodes to be a View.

Would anyone be interested in doing this, probably needs a child issue? I might have time to do it in the future if no one else does.

I'm assuming this would be best done as a Block that is just automatically placed in the Content region?

Neograph734’s picture

Hi Aaron,

As Colan suggested in #28, we should first focus on some sort of entity hierarchy API. Multiple implementations (including this one) could benefit from that.

AaronMcHale’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Postponed

@Neograph734 thanks for linking that issue, that make sense

I've taking a few hours to put together some thoughts and a proposal that I think would be a good way forward with minimal effort over on #267855: Provide an entity hierarchy API, as per previous suggestions let's continue discussing over there.

Also changed this to just "Posponed" as that seemed to make more sense, D.o really should have a way for issues to have more contextual postponed status, like linking the issue that caused them to be posponed or providing a reason that shows right at the top as a status message. Oh well guess that's a discussion for another time and place, in any case added that contextual info to this issue's summary.

colan’s picture

Issue summary: View changes

Reconciled the new issue title with the IS.

nod_’s picture

Title: Rewrite book module to use a standard, reusable API for creating hierarchies » [PP-1] Rewrite book module to use a standard, reusable API for creating hierarchies

just to show there is one issue to address before this can be started

AaronMcHale’s picture

D.o really should have a way for issues to have more contextual postponed status, like linking the issue that caused them to be posponed or providing a reason that shows right at the top as a status message.

4 years later, guess I'll settle for the community driven pattern of that we have of [PP-X] in the issue title 😄

catch’s picture

Since this issue was opened, book got some refactoring #2100577: Phase 1 - Decouple book module from menu inc - it doesn't change the current status (still need a generic entity hierarchy API to refactor it again on top of) but the starting point is a bit different.

Murz’s picture

https://www.drupal.org/project/entity_hierarchy is the great candidate to reuse for rewrite book module on more modern code

catch’s picture

aseabrook’s picture

Wouldn't it make more sense to just remove the book module from core (as was done with the blog module) and let it live on as a contributed module? It hasn't evolved much over the years and it's severely lacking some features (see https://www.drupal.org/project/drupal/issues/3173808 for an example). I'm not suggesting that the API idea is bad, it's just I think it isn't going anywhere fast because the book module is a part of core and we're beholden to that grander workflow/process.

AaronMcHale’s picture

Wouldn't it make more sense to just remove the book module from core (as was done with the blog module) and let it live on as a contributed module? It hasn't evolved much over the years and it's severely lacking some features (see https://www.drupal.org/project/drupal/issues/3173808 for an example).

That's an idea worth considering, after a very short Slack discussion, I've opened #3265493: [Policy] Move book to contrib in Drupal 11 so that there's a space to discuss this further.

I'm not suggesting that the API idea is bad, it's just I think it isn't going anywhere fast because the book module is a part of core and we're beholden to that grander workflow/process.

Even if book is moved to contrib, there's probably still an argument for having this proposed API in Core, since it could be useful for defining arbitrary entity hierarchies in contrib/custom projects, and potentially take some of what the taxonomy module does and turn it into a generic implementation which taxonomy simply uses.

catch’s picture

There are some very old core issues where we tried to introduce nested set hierarchy storage, to use for menu, book, taxonomy etc.

https://www.drupal.org/project/entity_hierarchy and https://www.drupal.org/project/nested_set are examples in contrib.

#344019: New implementation for database tree parsing ( taxonomy / comment ) is probably still the most relevant core issue.