dokuwiki-template-sprintdoc.../tpl/nav-meta-box.php
Andreas Gohr 038d4bfe8d moved tab generation to PHP, no empty tabs SPR-799
I still don't like the code directly in the template there. I think it
should be moved to a helper class.

The TOC CSS seems to be broken when there are no tabs right of the TOC.
2017-02-15 16:17:17 +01:00

59 lines
1.4 KiB
PHP
Executable file

<?php
if(!defined('DOKU_INC')) die();
global $lang;
$tabs = array();
$toc = tpl_toc(true);
if($toc) {
$tabs[] = array(
'id' => 'spr__tab-toc',
'label' => $lang['toc'],
'tab' => $toc,
'count' => null,
);
}
/** @var helper_plugin_tagging $tags */
$tags = plugin_load('helper', 'tagging');
if($tags) {
$tabs[] = array(
'id' => 'spr__tab-tags',
'label' => tpl_getLang('tab_tags'),
'tab' => $tags->tpl_tags(false),
'count' => null, // FIXME
);
}
// fixme add magicmatcher info
?>
<div class="tab-container">
<ul class="meta-tabs">
<?php
foreach($tabs as $tab) {
echo '<li>';
echo '<a href="#' . $tab['id'] . '" aria-expanded="false">';
echo '<span class="prefix">';
echo $tab['label'];
if($tab['count'] !== null) {
echo ' <span class="num">' . $tab['count'] . '</span>';
}
echo '</span>';
echo '</li>';
}
?>
</ul>
<div class="meta-content">
<div class="box-content">
<?php
foreach($tabs as $tab) {
echo '<div id="' . $tab['id'] . '" class="tab-pane" aria-hidden="true">';
echo $tab['tab'];
echo '</div>';
}
?>
</div>
</div>
</div>