You are here

function i18n_book_navigation_cleanup in Book translation 6.2

Same name and namespace in other branches
  1. 7.2 i18n_book_navigation.module \i18n_book_navigation_cleanup()

Cleans up the tree. Depending on the translation mode, some leaves my be displayed as "empty". Walks down the tree and unsets all "empty" items.

Parameters

array $tree: The menu tree

Return value

array The cleaned up menu tree

3 calls to i18n_book_navigation_cleanup()
i18n_book_navigation in ./i18n_book_navigation.module
Gets the translated menu tree for the original node.
i18n_book_navigation_children in ./i18n_book_navigation.module
Loads the direct child elements. Port from book_children(). Will perform a similar task, but will also translate the links.
i18n_book_navigation_menu_titles in ./i18n_book_navigation.module
Gets the menu titles for the book path. Port of _menu_titles of the token module. Will translate the tree before fetching the titles.

File

./i18n_book_navigation.module, line 300
Defines the i18n book navigation module. Contains all necessary data and hooks

Code

function i18n_book_navigation_cleanup($tree) {
  $new_tree = array();
  foreach ($tree as $item) {
    $temp = array();
    if (isset($item['link'])) {
      $temp['link'] = $item['link'];
      if ($item['below']) {
        $temp['below'] = i18n_book_navigation_cleanup($item['below']);
      }
      $new_tree[] = $temp;
    }
  }
  return $new_tree;
}