Drupal 8 core book module adds the Book navigation - previous / next links via hook_ENTITY_TYPE_view().

book_node_view()

Display suite module as this field via Drupal\ds\Plugin\DsField\Book\BookNavigation class however it doesn't not show on non-book types (Drupal core does) and does not show on default view mode either.

Joshua.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

silverham created an issue. See original summary.

silverham’s picture

Title: How to add book navigation (next/previous) to node display suite layout? » Book navigation (next/previous) field is missing on non-book types (any type can be part of a book) and not shown on default view mode.
Component: Documentation » Code
Category: Support request » Bug report
Issue summary: View changes
FileSize
1.07 KB

After checking the code, there a ds field BookNavigation.php, however it only show on book types, not any content types.

Drupal core allow any type to be part of a book. Even Drupal core book module will add these previous/next button to a node view.

@see

book_form_node_form_alter()
Drupal\book\BookManager::addFormElements()

Especially since migrating sites, with standard pages as part of a book on D7 site.

Additionally, the field doesn't show on the default view_mode.

Attached is patch to fix this.

silverham’s picture

Status: Active » Needs review
swentel’s picture

Hmm, but there's a setting at admin/structure/book/settings.

If I don't toggle the content type to be part of a book, I don't see the navigation in core either (even though I can add it to the outline as an admin). So, I still think it's ok no?

(note, the default/view is a bug indeed, that should be fixed)

kwfinken’s picture

@swentel

There is that setting in admin/structure/book/settings. When display suite is not active for a content type, that admin setting works. When display suite is enabled for a content type, that setting is ignored and book related items only shown on the "book" content type. I will download and review the patch sometime today.

kwfinken’s picture

Status: Needs review » Needs work

The patch did not work on my system

swentel’s picture

Version: 8.x-3.x-dev » 5.0.x-dev
swentel’s picture

Status: Needs work » Needs review
FileSize
568 bytes

allow default and full

  • swentel committed dd2fcde on 5.0.x
    Issue #3118182 by silverham, swentel: Book navigation (next/previous)...
swentel’s picture

Status: Needs review » Fixed

committed and pushed.

listens to default and view and the setting of book types, while I know that it's possible to for admins to add any, I rather want to follow the settings. If someone want to override it (or make available on other content types), you can create a new field simply.

swentel’s picture

Status: Fixed » Closed (fixed)
swentel’s picture

Actually, scratch my last comment, it's available on any content type now ..

swentel’s picture

Version: 5.0.x-dev » 8.x-3.x-dev
Status: Closed (fixed) » Active

  • swentel committed 10617587 on 8.x-3.x
    Issue #3118182 by swentel, silverham: Book navigation (next/previous)...
swentel’s picture

Status: Active » Fixed
swentel’s picture

Status: Fixed » Closed (fixed)