Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Original title
Remove the Book module from core
Original description
Why?
- It helps #1255674: [meta] Make core maintainable.
- It uses its own custom table, when folks are asking for a more generic relationship solution that works better with Views, etc.: #1192748: Views: Book module replacement in Views?
- Placing it in contrib will allow it to depend on other contrib modules to provide the desired behaviour. For an example of how this could be done, see http://drupal.org/node/1176828#comment-4818914.
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
Comment #1
Dave ReidNo.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedAs explained, I want to keep this one, and refactor it, Taxonomy, Menu (and possibly Comment) based on a single "Parent entity" hierarchical field.
Comment #3
colanSorry, I must have missed that in the shuffle. Works for me. :)
Comment #4
scroogie CreditAttribution: scroogie commentedDamien: Any starting points? I'd be interested.
Comment #5
good_man CreditAttribution: good_man commentedI'm interested in maintaining book and to keep it in core.
Can we benefit from chx new project Entity Tree
Comment #6
cweagans@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...
Comment #7
good_man CreditAttribution: good_man commentedYes 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.
Comment #8
fuzzy76 CreditAttribution: fuzzy76 commentedDid anything actually happen on this?
Comment #9
colanI think the plan is to go with Tree, but it might be a while before it gets into core.
Comment #10
cweagansHuh? Where was that decided?
Comment #11
colanI'm not sure it ever was; I'm just trying to read DamZ's mind. ;)
Comment #12
catchWe 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.
Comment #13
fuzzy76 CreditAttribution: fuzzy76 commentedAgreed. 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.
Comment #14
dawehnerWhen 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.
Comment #15
catch@dawehner that sounds very similar to #2 from 2011 but agreed if we actually did that it'd be a good test case.
Comment #16
catchComment #17
fuzzy76 CreditAttribution: fuzzy76 commentedOTOH, 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.
Comment #18
Bojhan CreditAttribution: Bojhan as a volunteer and commented@catch @dawehner Is the plan to wait till 2021 before that happens or rip it out before?
Comment #19
dawehner@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
Comment #20
Bojhan CreditAttribution: Bojhan as a volunteer and commentedI think that makes more sense for sure.
Comment #21
catch@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.
Comment #22
yoroy CreditAttribution: yoroy at Roy Scholten commentedThe 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".
Comment #23
catchThe 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.
Comment #24
fuzzy76 CreditAttribution: fuzzy76 commented@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. :-/
Comment #25
colanTo 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.
Comment #26
Neograph734I 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.
Comment #27
yoroy CreditAttribution: yoroy at Roy Scholten commentedWell well, look at this: #2862096: Replace Book module
(via https://www.drupal.org/node/2858431#comment-11995831)
Comment #28
colanI 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?
Comment #29
Bojhan CreditAttribution: Bojhan as a volunteer and commentedMakes sense, let do that.
When more information surfaces on that approach lets revisit this.
Comment #30
sakhan CreditAttribution: sakhan as a volunteer commentedSimply 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.
Comment #31
colan#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.
Comment #32
yoroy CreditAttribution: yoroy at Roy Scholten for Dropsolid commentedSomething like this? :-)
Comment #33
AaronMcHaleI'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?
Comment #34
Neograph734Hi 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.
Comment #35
AaronMcHale@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.
Comment #36
colanReconciled the new issue title with the IS.
Comment #37
nod_just to show there is one issue to address before this can be started
Comment #38
AaronMcHale4 years later, guess I'll settle for the community driven pattern of that we have of
[PP-X]
in the issue title 😄Comment #39
catchSince 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.
Comment #40
Murzhttps://www.drupal.org/project/entity_hierarchy is the great candidate to reuse for rewrite book module on more modern code
Comment #41
catchComment #42
aseabrook CreditAttribution: aseabrook commentedWouldn'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.
Comment #43
AaronMcHaleThat'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.
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.
Comment #44
catchThere 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.