You are here

function i18n_book_navigation_cleanup in Book translation 7.2

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

Clean up the menu 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.

2 calls to i18n_book_navigation_cleanup()
i18n_book_navigation in ./i18n_book_navigation.module
Get the translated menu tree for the original node.
i18n_book_navigation_children in ./i18n_book_navigation.module
Load the direct child elements.

File

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

Code

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