You are here

function epub_ncx_item in Epub 8

Same name and namespace in other branches
  1. 7 epub.module \epub_ncx_item()
1 call to epub_ncx_item()
epub_get_toc in ./epub.module

File

./epub.module, line 222

Code

function epub_ncx_item($navmap, $target = FALSE) {
  $html = '<ol>';
  foreach ($navmap as $item) {
    if ($item
      ->attributes()->id) {
      $html .= '<li><a href="' . $item->content
        ->attributes()->src . '"';
      if ($target) {
        $html .= ' target="' . $target . '" ';
      }
      $html .= '>' . $item->navLabel->text . '</a>';
      if ($item->navPoint) {
        $subitems = epub_ncx_item($item->navPoint, $target);
        $html .= $subitems;
      }
      $html .= '</li>';
    }
  }
  $html .= '</ol>';
  return $html;
}