When you open the child sort page on a book node that has no children, and click "save", you get a screenful of errors:

  • Notice: Undefined index: tree_hash in book_child_order_form_validate() (line 45 of book_child_order/book_child_order.pages.inc).
  • Notice: Undefined index: tree_current_hash in book_child_order_form_validate() (line 45 of book_child_order/book_child_order.pages.inc).
  • Notice: Undefined index: table in book_child_order_form_submit() (line 58 of book_child_order/book_child_order.pages.inc).
  • Warning: array_keys() expects parameter 1 to be array, null given in array_keys() (line 58 of book_child_order/book_child_order.pages.inc).
  • Warning: array_flip() expects parameter 1 to be array, null given in array_flip() (line 58 of book_child_order/book_child_order.pages.inc).
  • Warning: array_merge(): Argument #1 is not an array in array_merge() (line 60 of book_child_order/book_child_order.pages.inc).
  • Warning: Invalid argument supplied for foreach() in element_children() (line 6487 of includes/common.inc).

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new603 bytes

This patch hides the save button if there are no child pages.

joachim’s picture

Status: Needs review » Postponed (maintainer needs more info)

Thanks for the patch!

It's a while since I've looked at this module, but if the book page has no children, then isn't the whole form pointless? In which case, wouldn't it be better to hide the tab completely?

damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new735 bytes

The only problem I can see with that is that the $node doesn't track sibling objects, so we'd have to use e.g. book_children() or book_menu_subtree_data(). Something like this?

damienmckenna’s picture

FYI the patch in #3 only shows the tab if there's more than one subpage, there's no point in showing it if there's only one subpage.

joachim’s picture

Status: Needs review » Fixed

Committed. Sorry for the delay, and thanks again for the patch!

  • joachim committed 34b5842 on 7.x-1.x authored by DamienMcKenna
    Issue #2465543 by DamienMcKenna: Fixed child sort tab appearing on a...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.