function i18n_book_navigation_nodeapi in Book translation 6
Same name and namespace in other branches
- 6.2 i18n_book_navigation.module \i18n_book_navigation_nodeapi()
Implementation of hook_nodeapi()
Check wether this node is a translation and that the original node is part of a book outline. If so, prepare the book navigation
File
- ./
i18n_book_navigation.module, line 52
Code
function i18n_book_navigation_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'view':
// Check that we're not dealing with the original node itself
// or with a non-translated node
if ($node->nid != $node->tnid && $node->tnid != 0 && !$teaser) {
// Get the original node book array
$tnode = (object) array(
'nid' => $node->tnid,
);
$book_info = book_nodeapi($tnode, 'load', $teaser, $page);
if (!empty($book_info['book']['bid'])) {
$node->content['i18n_book_navigation'] = array(
'#value' => theme('i18n_book_navigation', $book_info['book']),
'#weight' => 100,
);
}
}
break;
}
}