You are here

function i18n_book_navigation_children in Book translation 6.2

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

Loads the direct child elements. Port from book_children(). Will perform a similar task, but will also translate the links.

Parameters

array $book_link: The link data

Return value

string The child elements as HTML. If no child elements were found, the string will be empty

See also

book_children()

1 call to i18n_book_navigation_children()
template_preprocess_i18n_book_navigation in ./i18n_book_navigation.module
Preprocesses the i18n_book_navigation. Very similar to the book_navigation, the i18n_book_navigation uses the same template file and template variables. These variables will be translated and the urls adapted.

File

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

Code

function i18n_book_navigation_children($book_link) {
  $flat = book_get_flat_menu($book_link);
  $children = array();
  if ($book_link['has_children']) {

    // Walk through the array until we find the current page.
    do {
      $link = array_shift($flat);
    } while ($link && $link['mlid'] != $book_link['mlid']);

    // Continue though the array and collect the links whose parent is this page.
    while (($link = array_shift($flat)) && $link['plid'] == $book_link['mlid']) {
      $data['link'] = $link;
      $data['below'] = '';
      $children[] = $data;
    }
  }

  // Translate the tree
  $children = i18n_book_navigation_translate_tree($children);

  // Clean it up
  $children = i18n_book_navigation_cleanup($children);

  // Render it
  return $children ? menu_tree_output($children) : '';
}