I checked out the usual issues related to the "add content" blocks, etc. not showing up, but are there other ways to trouble shoot this? I tried uninstalling all of the panels related modules, reinstalling, and reenabling them. The book navigation block, for instance, can't be added to a panel, because it's not available in the "add content" pop-up. However, its checkbox is checked under the setting for adding it to panels and mini-panels. Any help would be appreciated.

Comments

A couple of blocks are specifically hidden:

<?php
function profile_ctools_block_info($module, $delta, &$info) {
 
// Hide the author information block which isn't as rich as what we can
  // do with context.
 
$info = NULL;
}
function
book_ctools_block_info($module, $delta, &$info) {
 
// Hide the book navigation block which isn't as rich as what we can
  // do with context.
 
$info = NULL;
}
?>

It's possible that I've removed these without providing proper replacements but I think both of them can be properly done if you have context.

Status:Active» Fixed

Status:Fixed» Closed (fixed)

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

A favor please.

Until I understand how to recreate the book navigation block with context can you let me know where I can uncomment/delete the php that hides the book navigation block. I can't seem to find it.

Thanks

Category:bug» support
Status:Closed (fixed)» Active

manogolf,
Please share what you did to get the book navigation working.

Thanks,
-Tim

Tim,

I never did find the code that blocked the book navigation block, but then I'm not the shiniest penny in the role either. I solved by creating a view with the field of node titles, and filtering with node type = book page, and book depth = 1. Can't be sure if this works for everyone though.

I had four existing books, and wanted to show them on my panels built homepage. I provided the title for the views built book navigation block in views (It really is just a set of links to the books). Then displayed the view in a mini-panel aside three other views built content displays.

You can see the result on my homepage at http://manogolf.com in the lower left titled "Fantasy Golf League Results'.

I'm not the best source for problem solving as most of my work is a struggle at best. Eventually it somehow gets pulled together though.

Hopefully this helped?

Jerry

Jerry,
Thanks for the reply. I was hoping for a block that would show book navigation just for the book you were currently viewing. Looks like the default book navigation block (which I just enabled via the blocks system to test) shows all books navigation, even if you are viewing a page within a specific book. So I doubt exposing the book navigation block in a panel would get me what I want. I'll look into creating a view with an argument for the parent book, so I can limit the navigation to the current page's book.

Still, the Panels module shouldn't arbitrarily disable/hide certain blocks.

-Tim

Sorry, the code that removes those blocks is in the block.inc content type.

<?php
function book_ctools_block_info($module, $delta, &$info) {
 
// Hide the book navigation block which isn't as rich as what we can
  // do with context.
 
$info = NULL;
}
?>

This 'block.inc' file is located at "ctools/plugins/content_types/block/block.inc".

Status:Active» Fixed

Note that there IS a replacement book navigation that uses context. It will be under the 'Node' category (which only appears if you have a node context available) and is called Book navigation.

Status:Fixed» Closed (fixed)

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

Hi Merlin,

It is not a replacement in the sense that both produce different outputs. In my case I want to have a navigation-menu-like overview of the Book that shows the current selection in the context of the book's outline. Anyway that is exactly what the Book navigation block provides. So, my question is why the Book navigation block is actually hidden from the Add Context selection? Is it because it might be confusing because of the name?

Thanks,
Willem

I put it back on my own installation. Currently with Views there I couldn't find a way to get something like that with the hierarchy in place and showing the current position in the book.

Hey there! At first glance this appears to be working. Create a custom block - add this code to the body and make sure you have format set to php.

<?php
$book_top_page
='%node:nid';
 
$tree = menu_tree_all_data(book_menu_name($book_top_page));
  print
drupal_render(menu_tree_output($tree));
?>

I'm doing this on a Node panel so it uses the %node:nide context to pull that books' info. I just wonder how to exclude the top page from the list. I'll play with it.

I'm using drupal 7 panels but I think you can modify the original code found at http://drupal.org/node/44648 to suit your needs.

Title:Adding Book Navigation Block to pane via custom phpMissing Blocks, etc. from "Add Content" pop-up

Ok that only worked on the first page of the book. I tried to implement

<?php
if ($book_link['nid'] === $book_link['bid']) {
 
$book_top_page='%node:nid';
}
else {
 
$book_top_page='%book_parent:nid';
}
 
$tree = menu_tree_all_data(book_menu_name($book_top_page));
  print
drupal_render(menu_tree_output($tree));
?>

by adding a book parent relationship but can't get it to work on child pages? Anyone else able to chime in for the D6 or D7 version?

Title:Missing Blocks, etc. from "Add Content" pop-upAdding Book Navigation Block to pane via custom php
Status:Closed (fixed)» Active

updated title to better reflect theme of discussion

There really is no decent replacement for this block, unfortunately, it's too tied in with Book. Hiding it is... painful. Is there really a good reason to have it be hidden and not let the user decide if they want to use the (less configurable by default) node context-version, or the default Book Navigation block, on their own?

Title:Missing Blocks, etc. from "Add Content" pop-upAdding Book Navigation Block to pane via custom php

dp

Yay - sort of. Just doesn't show the top level title link of the tree.

Make sure you have added a book parent relationship.
Then add a Book Children content pane from the available Node selections. Have it set to show for Book Parent.

I personally do not need the top book title at the top of my list since my users are only able to see one book at a time but if you do - try my original idea from #15,#16 and break it into two panes.

One pane with

$book_top_page='%node:nid';
$tree = menu_tree_all_data(book_menu_name($book_top_page));
print drupal_render(menu_tree_output($tree));

and one with
$book_top_page='%book_parent:nid';
$tree = menu_tree_all_data(book_menu_name($book_top_page));
print drupal_render(menu_tree_output($tree));

I'm still not happy with the implementation I came up with. Works so so for one level books. Also, found this - http://drupal.org/project/bookblock which I really like except that you have to check off each of the books you want to make a block for. Not so hot if your users are creating books.

Alright - I gave up. I commented out lines 315 - 319 in the block.inc file for ctools (drupal 7 - same code as merlin's above). Shows up fine now in the content list to add to a pane. Works as expected and I'm pleased. As my php coding progresses I'm sure I'll take a crack at bringing it in as 'context aware' (since I'm assuming that is why it was disabled) OR I'll try to make some type of options addon for cpanels that allows you to check on/off to add drupal missing items.

Good luck to you all! Feel free to close this out since I reopened it unless anyone more experienced than me can come up with a better solution.

I don't want it closed! :) I'm convinced that, community-wise, disabling another module's blocks is not good practice, regardless of the altruistic reasons for the change. Especially since the replacement is not nearly as simple, and leaving it in place harms nothing.

I agree with Reinette. That block should not be disabled. The Book Navigation proposed as a replacement that is under the Node category show a different thing and is no good. It shows a Next page, top page, Previous page navigation. Instead of a hierarchical list of all the nodes within the book I'm currently seeing.

subscribing...

Category:support» feature

it sounds to me like this has turned into a feature request? Updating...

This sounds like a bug to me.....

I want to create a panel that will display the parent page of a book when the user is on a child page. The tools are available in the panels admin screens but I do not think it is working.

I am looking at the following settings page.

Administrator --> structure--> mini panels --> settings ( of the selected mini-panel) --> content -->add content --> node tokens - book

on this page there are some variables to select the

1. node or the book parent
2. override title
3. Sanitize

This feature does not display anything no matter what combination of settings i am selecting. Is there something wrong here? i am assuming that when I am viewing a child page i would expect to see the book title displayed for that child in the panel.

Any idea why this does not work?

How can I display the book title of any child page?

Thanks,

Spineless

@spineless try looking in the "replacement patterns" section. It will end up being something like "%book_parent:title" that you will use. I haven't tried node tokens in mini panels but try custom output using the replacement pattern and see if that helps. Otherwise it might be a different issue?

Yes I agree. I should be able to use a substitution. I tried that several different ways to see if it would take. I am not sure what would prevent this from working. I have seen this error in other modules as well. Maybe there is a bug in the core or I am not using the %book_parent:title string the right way.

I even tried other string to point at different nodes such as

%node:book
%book_parent:nid
%node:author

I am using the override title cell in the content screen for min-panel.

i think there might be an issue with the Node (token) option. I tried to select author as a node token and this did not work either.

Any ideas how I can troubleshoot this?

Thanks,

spineless

@spineless, sorry, I don't use mini panels.. open a new issue though and I'm sure someone will chime in.

I'm still confused as to why the book navigation is being intentionally disabled. After spending hours trying to create the "rich" block made possible by contexts, I stumbled upon this thread, commented out the code in #9 , and immediately had exactly what I needed.

I'm the first to say that the entire book interface sucks. But hiding a built-in function when panels/ctools doesn't provide anything similar out of the box seems misguided. Unless the default book navigation somehow interferes with the context-enabled book navigation (and I don't think it does, as I had both operating at the same time when I first commented out the code), I don't really see why this should be getting disabled.

I guess for now I'll create a custom module that specifically overrides the panels/ctools function. But this seems really silly. Just let the default book navigation appear, and allow power users to create their own custom versions using contexts.

Assigned:Unassigned» merlinofchaos

@merlin
I'm not sure I understand exactly why you have hidden this block?

I'm not really familiar with the Book module, but we don't intentionally hide any other of Drupal's subsystems, do we? I'm not really a fan of blocks, and sometimes I wish Panels could be a blocker for "Block", but not everyone feels that way, and it seems to me like we should unhide this.
Unless we provide a better implementation ofc :)

+1

I'll join the vote, along with jackbravo, Letharion, rootwork, spineless, and Reinette.

This is currently prohibiting me from recreating a simple book node layout using Panels. My ideal layout would be similar to documentation pages on d.o, with a sidebar navigation of the entire book structure in addition to the regular (node context) Book navigation underneath the body.

In comment #1 of #1405682: Node/Book Navigation shows current level only Earl describes a way to make the current Book navigation pane provided by Panels show the level 1 book links, even if you are inside a book, a couple levels deep. However, if you are on a book page below L1, this workaround does not *expand* the navigation links with active-trails down into the current page, so it does not work as a general solution for a replacement for the missing book navigation block.

Version:6.x-3.x-dev» 7.x-3.x-dev
Status:Active» Needs review
StatusFileSize
new2.42 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Part of the confusion on the part of CTools may come from a befuddled core block / template names in the book module. The term 'navigation' in the book module is thrown around loosely to mean either:

  1. the current book page's contextual (i.e. pager) navigation. This includes the next/previous and parent links. The template file in the book module called book-navigation.tpl.php is used to theme a book page's contextual navigation (ie, the horizontal *pager* navigation shown in the content of a book page node).
  2. a hierarchical listing (i.e. menu) of book pages, optionally, with active-links, if on a book page. If not on a book page, this block shows a listing of all top-level book nodes. The block that is used to list this menu layout is named "Book navigation", but does not use the aforementioned book-navigation.tpl.php, but rather book-all-books-block.tpl.php.

The current "Book navigation" pane provided by CTools offers support for only option 1, while I think what most people here are asking about is support for option 2.

The first thing I tried was to simply un-disable the default navigation block in ctools/plugins/content_types/block/block.inc

function book_ctools_block_info($module, $delta, &$info) {
  $info['icon'] = 'icon_core_block_menu.png';
  $info['category'] = t('Node');
  // Pseudo-code solution! Read below and see patch for a more complete option.
}

This works but it's not ideal in two ways:

- it effectively creates *two* panes with the same name "Book navigation". I solved this by tweaking the title of the pane in node_book_nav.inc to the more apt 'Book pager', and the core block to 'Book menu'.
- the core block menu doesn't take advantage of panels contexts, however, this may not be necessary -- it satisfied my needs.

The second thing I looked at was to add logic into the Book navigation CTools implementation that would add option 2 functionality, however, the problem then becomes that we'd have to completely duplicate the code from book module's block_block_view() just in order to get proper CTools contexts to work. This is because core book module depends on core's concept of "context", namely, the menu system, to obtain the node object to build the navigation. It's a good chunk of 35 lines of very specific book module code that I'm not sure belongs duplicated in CTools module.

So given these circumstances, I think the first solution is better.

One additional change that I'd like to do is adjust the icons, so they match their underlying functionality. This patch does that as well.

Status:Needs review» Needs work

I think I would rather just duplicate the code and provide a proper book navigation pager that utilizes context. The whole point of this system is to get around core's lack of context.

Thanks for clarifying that I was actually providing the wrong thing; I don't think I understood that, and there's a lot of system so lots of stuff falls in the cracks.

Posted by rootwork on November 15, 2011 at 5:39pm

I'm still confused as to why the book navigation is being intentionally disabled. After spending hours trying to create the "rich" block made possible by contexts, I stumbled upon this thread, commented out the code in #9 , and immediately had exactly what I needed.

I'm the first to say that the entire book interface sucks. But hiding a built-in function when panels/ctools doesn't provide anything similar out of the box seems misguided. Unless the default book navigation somehow interferes with the context-enabled book navigation (and I don't think it does, as I had both operating at the same time when I first commented out the code), I don't really see why this should be getting disabled.

I guess for now I'll create a custom module that specifically overrides the panels/ctools function. But this seems really silly. Just let the default book navigation appear, and allow power users to create their own custom versions using contexts.

As I said, I didn't realize at the time I was providing the wrong thing. We need to provide the right thing.

Just let the default book navigation appear, and allow power users to create their own custom versions using contexts.

As Merlin said in #36, the proper solution would be for CTools to *provide* the context-aware book navigation.

So where are we?:

Anyone who has the time and need, please take my patch in #35 and run with it... to create a fully context-aware replica of the book navigation.

Project:Panels» Chaos tool suite (ctools)
Version:7.x-3.x-dev» 7.x-1.x-dev
StatusFileSize
new23.73 KB
new26.25 KB
new18.98 KB

I've applied the patch to the ctools project. It works as expected.

A book structure

Viewing a non book page still shows the book outline. Not sure why. Panels cache?

A non book page

and it's structure

not part of a book structure

So this needs some work but it looks as expected regarding the book hierarchy.

I hope this patch can get in asap as missing the book structure blok is a pitb

Category:feature» bug
Status:Needs work» Needs review
StatusFileSize
new6.02 KB
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

#40 is a user err ... one must configure the block settings 'Only show on book pages'

Attached patch is hopefully what @merlinofchaos said in #36.

I did not manage use the block settings 'all pages' , 'book pages' choice.

Also the $block->subject (which should contain a link to top level book page when 'book pages') is not displayed.

I've kept status to needs review as I need help. See below for the help parts.

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+    // TODO: the value is not available somehow?!?
+    $book_block_mode = isset($conf['book_block_mode']) ? $conf['book_block_mode'] : 'book pages';

Where should the settings come from?

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+    // Code belong is taken from function book_block_view($delta = '') {
+    // $block = array();

Commented to keep code similar from function book_block_view

Do we want to keep is similar or delete not needed lines?

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+    // if ($node = menu_get_object()) {

Ditto

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+    // }

Ditto

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+        // TODO: subject is not rendered
+        $block->subject = theme('book_title_link', array('link' => $data['link']));
+        $block->content = ($data['below']) ? menu_tree_output($data['below']) : '';

This is in the original version link to top level item.

+++ b/plugins/content_types/node_context/node_book_menu.inc
@@ -0,0 +1,105 @@
+  // TODO: this does not work yet.
+  //       See TODO in: ctools_node_book_menu_content_type_render
+  if (isset($form_state['input']['book_block_mode'])) {

Is this wrong? Setting is not kept :-/

To test against core behaviour add these lines and configure the block though block admin page. See #35

+++ b/plugins/content_types/block/block.inc
@@ -313,9 +313,9 @@ function profile_ctools_block_info($module, $delta, &$info) {
function book_ctools_block_info($module, $delta, &$info) {
-  // Hide the book navigation block which isn't as rich as what we can
-  // do with context.
-  $info = NULL;
+  $info['title'] = t('Book navigation menu');
+  $info['icon'] = 'icon_core_block_menu.png';
+  $info['category'] = t('Node');
}

Still needs review | help

Thanks! I was looking for this very thing and your patch worked for me.

If it helps at all:

I got the block title to render correctly by setting $block->title = $block->subject and not using the override title option.

If someone is still looking for a solution regarding ctools/panels and book navigation, try menu block module (https://drupal.org/project/menu_block). Although panels in the latest version allowed me to place the actual book navigation into my node panel, it did not behave as I expected. I wanted a tree structure that showed the hierarchical depths of the book with the child pages floating immediately below the parent when the parent is the active item. It worked very nicely with menu block, I just had to do one workaround to get the child pages to show up on the top level book parent. I did that by using the "book children" block which is listed under "Node" in panels and using visibility to only show it on the top level book page. No contexts need to be set...