function i18n_book_navigation_token_values in Book translation 6
Same name and namespace in other branches
- 6.2 i18n_book_navigation.module \i18n_book_navigation_token_values()
File
- ./
i18n_book_navigation.module, line 565
Code
function i18n_book_navigation_token_values($type, $object = NULL, $options = array()) {
$tokens = array();
if ($type == 'node') {
$tokens['i18n-bookpath'] = '';
$tokens['i18n-bookpath-raw'] = '';
$node = _i18n_book_navigation_get_original_node($object, TRUE);
if ($node->book['menu_name']) {
$menus = menu_get_menus();
$trail_raw = i18n_book_navigation_menu_titles($node->book, $node->nid, $object->language);
$book_raw = $trail_raw[0];
$book = check_plain($book_raw);
// For book paths, we don't include the current node's title (last in
// the array) in the trail.
array_pop($trail_raw);
$trail = array();
foreach ($trail_raw as $title) {
$trail[] = check_plain($title);
}
$tokens['i18n-bookpath'] = !empty($options['pathauto']) ? $trail : implode('/', $trail);
$tokens['i18n-bookpath-raw'] = !empty($options['pathauto']) ? $trail_raw : implode('/', $trail_raw);
}
}
return $tokens;
}