You are here

function _site_map_books in Site map 6.2

Same name and namespace in other branches
  1. 8 site_map.module \_site_map_books()
  2. 5 site_map.module \_site_map_books()
  3. 6 site_map.module \_site_map_books()
  4. 7 site_map.module \_site_map_books()

Render books.

1 call to _site_map_books()
template_preprocess_site_map in ./site_map.theme.inc
Process variables for site-map.tpl.php.

File

./site_map.module, line 251
site_map.module

Code

function _site_map_books() {
  $output = '';
  $nids = array_filter(variable_get('site_map_show_books', array()));
  if (module_exists('book') && !empty($nids)) {
    $title = t('Books');
    $description = '<div class="description">' . t("Books at %sn.", array(
      "%sn" => variable_get('site_name', 'Drupal'),
    )) . '</div>';
    $book_menus = array();
    foreach ($nids as $nid) {
      $node = node_load($nid);
      $tree = menu_tree_all_data($node->book['menu_name']);
      $data = array_shift($tree);
      $output .= theme('book_title_link', $data['link']);
      $output .= $data['below'] ? _site_map_menu_tree_output($data['below']) : '';
    }
    if (!empty($output)) {
      $output = theme('site_map_box', $title, $description . $output, 'site-map-book-box');
    }
  }
  return $output;
}