You are here

function i18n_book_navigation_theme in Book translation 7.2

Same name and namespace in other branches
  1. 6.2 i18n_book_navigation.module \i18n_book_navigation_theme()
  2. 6 i18n_book_navigation.module \i18n_book_navigation_theme()

Implements hook_theme().

The i18n_book_navigation uses the book-navigation.tpl.php file for theming the "footer" book navigation in book pages. It will use it to display this navigation on translated nodes, even if they're not part of a book outline. We must implement our own theme however, because the default book_navigation will call menu_tree_all_data() before i18n_book_navigation, which will store an empty tree statically, preventing us from using it and translating the links.

Note that, because of the way Drupal template auto-discovery works, a theme cannot override the i18n_book_navigation rendering using the book-navigation.tpl.php template. Drupal bases the template discovery on the theme key, NOT the template property. So, if a theme wishes to override the default template, it must use i18n-book-navigation.tpl.php instead.

File

./i18n_book_navigation.module, line 25
Defines the Book translation module.

Code

function i18n_book_navigation_theme($existing, $type, $theme, $path) {
  return array(
    'i18n_book_navigation' => array(
      'variables' => array(
        'book_link' => NULL,
      ),
      'path' => drupal_get_path('module', 'book'),
      'template' => 'book-navigation',
    ),
  );
}