Make Outline Block's title a link to the first entry
PRFB - July 15, 2007 - 23:18
| Project: | Outline |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Is there a way to make the title of an Outline navigation block a click-able link to the first page of the outline?
I want users who are mid-outline to have an easy way to get back to the beginning. I guess people could click on the Breadcrumb, but I have a feeling the top of the navigation block will feel like the "natural" thing to do. (It is for me.)
Thanks,
Patricia

#1
I actually consider this a useability bug.
I am not sure it is possible to make the title a link.
But even if we can, the situation is more complex than that, because outline.module allows you to put several pages at the top-level of an outline, in which case the navigation block IS broken.
I am busy, so I won't be able to have a look at this issue soon. But if someone submits a patch, I will look at it promptly.
#2
Below is AgentRickard's solution to the issue for Book (posted as http://drupal.org/node/159582#comment-252558).
Can anyone comment on what would need to change to make this work for Outline?
And what are the risks in case of multiple top-level pages?
Thanks,
Patricia
---
Block description: Custom book block
Block title: leave empty
Block body:
<?php
$result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), arg(1));
if (db_num_rows($result) > 0) {
$node = db_fetch_object($result);
$path = book_location($node);
$path[] = $node;
$expand = array();
foreach ($path as $key => $node) {
$expand[] = $node->nid;
}
}
$subject = l($path[0]->title, 'node/'. $path[0]->nid);
$content = book_tree($expand[0], 5, $expand);
print '<h3>'. $subject .'</h3>';
print $content;
?>
Input format: PHP code
Show block on specific pages: Show if the following PHP code returns TRUE (PHP-mode, experts only).
Pages:
<?php
// Only display this block when the user is browsing a book:
if (arg(0) == 'node' && is_numeric(arg(1))) {
return TRUE;
}
else {
return FALSE;
}
?>
#3
The risk is only a useability one. You can try: it won't hurt and you can change back later. But this feature is not yet fully ready, in terms of navigability (previous - next - up links at the bottom), and support in the navigation block, as I mentioned above.
Thanks for the code. I will need some more time to study a global solution for outline.