First of all, excuse my English, but I hope this issue is pretty easy for understanding.

When using book module, book navigation block outputted in very bottom of any node, disregarding the order of fields of content type. For example, if I add any CCK field and want to output it below book navigation, I can't do it because of this part of code in the /modules/book/book.module:

$node->content['book_navigation'] = array(
  '#value' => theme('book_navigation', $node->book),
  '#weight' => 100,
);

As you can see, book navigation block always has weight of 100, regardless of fields order in the content type form.

So I made a quick and dirty patch to make the book obey the order of fields:

--- book.module.orig    2012-05-02 20:36:16.000000000 +0400
+++ book.module 2012-08-07 14:36:24.000000000 +0400
@@ -665,9 +665,10 @@
     if (!$teaser) {
         if (!empty($node->book['bid']) && $node->build_mode == NODE_BUILD_NORMAL) {

+          $myvar = variable_get("content_extra_weights_".$node->type, array());

           $node->content['book_navigation'] = array(
             '#value' => theme('book_navigation', $node->book),
-            '#weight' => 100,
+            '#weight' => (!empty($myvar['book'])) ? $myvar['book'] : 100,
           );

           if ($page) {

Now I can put book navigation in any place on the node, e.g. above the list of attached files.

But it works only with CCK module, because I don't find right from the start where weights for standard field like title/menu/body stored. So if anybody can give me a clue for it, I can rewrite this simple patch in more decent form.

Comments

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.