Book Navigation Block does not sort Books by weight

Created on 18 November 2016, about 8 years ago
Updated 4 September 2024, 3 months ago

Problem/Motivation

The Book Navigation Block does not sort the list of books by weight.

A weight can be assigned to the first page of a book through the outline tab, however it has no effect.

I've created a patch and will submit it shortly. It's my first patch!

NB: this concerns the order of multiple books, NOT ordering pages within a book.

Steps to Reproduce:

  • Enable the book module (it's in core)
  • Create two books:
  • Add content > Book page >
    • Title: 'My first book'
    • Expand 'Book outline' settings - choose 'Create a new book'
    • Then do the same for 'My second book'
  • Structure > Block layout > Add a Book navigation block in the sidebar
    (Use the default settings.)
  • Observe that it shows 'My first book' then 'My second book'
  • Click the second book, Outline tab, change the weight to negative (so it should appear above book 1 in the list)
  • Observe list is still in the same (wrong) order.
  • Apply patch, refresh, order should have changed.

Proposed resolution

Simple sort of books using sortByWeightElement.

Remaining tasks

- Write tests.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

2.0

Component
BookΒ  β†’

Last updated 3 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @pwolanin
Created by

πŸ‡ΊπŸ‡ΈUnited States mtnguru

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024