diff options
Diffstat (limited to 'modules/book/book.admin.inc')
-rw-r--r-- | modules/book/book.admin.inc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc index 53f4b40e8..50ec79336 100644 --- a/modules/book/book.admin.inc +++ b/modules/book/book.admin.inc @@ -175,6 +175,10 @@ function _book_admin_table($node, &$form) { * @see book_admin_edit() */ function _book_admin_table_tree($tree, &$form) { + // The delta must be big enough to give each node a distinct value. + $count = count($tree); + $delta = ($count < 30) ? 15 : intval($count / 2) + 1; + foreach ($tree as $data) { $form['book-admin-' . $data['link']['nid']] = array( '#item' => $data['link'], @@ -190,7 +194,7 @@ function _book_admin_table_tree($tree, &$form) { 'weight' => array( '#type' => 'weight', '#default_value' => $data['link']['weight'], - '#delta' => 15, + '#delta' => max($delta, abs($data['link']['weight'])), '#title' => t('Weight for @title', array('@title' => $data['link']['title'])), '#title_display' => 'invisible', ), |