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.
When reordering book pages at admin/content/book/%node, you get the following fatal error:
Fatal error: Call to a member function save() on a non-object in core/modules/menu_link/menu_link.module on line 120
It looks like a regression after the menu_link conversion. book_menu_subtree_data() returns an array of menu links, which book_admin_edit_submit() then calls a direct menu_link_save() on.
Tests are also needed, since testbot isn't catching this.
Comment | File | Size | Author |
---|---|---|---|
#9 | book-menu-order-1933190-5-before.png | 44.99 KB | andymartha |
#9 | book-menu-order-1933190-5-after.png | 43.39 KB | andymartha |
#5 | book-menu-order-1933190.5.interdiff.txt | 2.13 KB | larowlan |
#5 | book-menu-order-1933190.5.patch | 3.24 KB | larowlan |
#2 | book-menu-order-1933190.2.fail_.patch | 1.41 KB | larowlan |
Comments
Comment #1
larowlanTackling this
Comment #2
larowlanTest only patch to demonstrate fail.
Test + fix.
Comment #3
duellj CreditAttribution: duellj commentedThanks for the quick patch larowlan! One thing that I noticed:
Since #item is no longer used, should it be removed? At the very least, the assignments to $row['#item']['plid'] and $row['#item']['weight'] should be removed.
Comment #4
duellj CreditAttribution: duellj commentedAlso, the tests should probably be updated to include testing for changing book parents, not just weight.
Comment #5
larowlanNew patch adds test for altering parents and removes snippet indicated at #4.
Comment #6
larowlanor rather the snippet at #3
Comment #8
larowlan#5: book-menu-order-1933190.5.patch queued for re-testing.
Comment #9
andymartha CreditAttribution: andymartha commentedI can confirm that on a fresh installation of Drupal 8.x-dev on March 6th, 2013, the problems described in this description happened (see screenshot). After applying the patch book-menu-order-1933190.5.patch in #5 by larowlan, I was able to order the book pages at the described url by parents and weight with no errors. See screenshot.
Comment #10
webchickExcellent! Bug fixes + tests is my favourite evening snack. :) Thanks a lot for the screenshots too, andymartha!
Committed and pushed to 8.x. Thanks!