function _spaces_core_block_book in Spaces 5.2
Same name and namespace in other branches
- 5 spaces_core/spaces_core.module \_spaces_core_block_book()
- 6 spaces_core/spaces_core.module \_spaces_core_block_book()
Spaces version of the book nav block -- shows all root books in a group
1 call to _spaces_core_block_book()
- spaces_core_block in spaces_core/
spaces_core.module - Implementation of hook_block().
File
- spaces_core/
spaces_core.module, line 307
Code
function _spaces_core_block_book() {
$space = spaces_get_space();
if ($space) {
// Only display this block when the user is browsing a book:
$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;
}
$features = spaces_features();
$feature_menu = space_customizer_menu::customize($space, 'book', $features['book']->spaces['menu']);
$block['subject'] = isset($feature_menu['documents']['title']) ? $feature_menu['documents']['title'] : t('Documents');
$block['content'] = _spaces_core_book_tree(0, 5, $expand);
return $block;
}
}
}