Update Logo rendering

This commit is contained in:
2026-03-06 09:34:09 +01:00
parent 27a4ac604f
commit 79a31340a8
9 changed files with 137 additions and 99 deletions

View File

@@ -6,6 +6,23 @@
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
$siteToolsHtml = (new \dokuwiki\Menu\SiteMenu())->getListItems('action ');
$userToolsHtml = '';
if ($conf['useacl']) {
$userToolsHtml = (new \dokuwiki\Menu\UserMenu())->getListItems('action ');
}
$breadcrumbsHtml = '';
if ($conf['youarehere']) {
$breadcrumbsHtml = tpl_youarehere(null, true);
}
if (!$breadcrumbsHtml && $conf['breadcrumbs']) {
$breadcrumbsHtml = tpl_breadcrumbs(null, true);
}
$templateLogoUrl = tpl_basedir() . 'images/logo.svg';
$templateLogoPath = DOKU_TPLINC . 'images/logo.svg';
?>
<!-- ********** HEADER ********** -->
@@ -13,76 +30,79 @@ if (!defined('DOKU_INC')) die();
<?php tpl_includeFile('header.html') ?>
<div class="headings group">
<ul class="a11y skip">
<li><a href="#dokuwiki__content"><?php echo $lang['skip_to_content']; ?></a></li>
</ul>
<ul class="a11y skip">
<li><a href="#dokuwiki__content"><?php echo $lang['skip_to_content']; ?></a></li>
</ul>
<h1 class="logo"><?php
// get logo either out of the template images folder or data/media folder
$logoSize = [];
$logo = tpl_getMediaFile([
':wiki:logo.svg', ':logo.svg',
':wiki:logo.png', ':logo.png',
'images/logo.svg', 'images/logo.png'
], false, $logoSize);
<div class="header__bar">
<div class="headings header__brand">
<h1 class="logo"><?php
$logoSize = [];
$logo = tpl_getMediaFile([
':wiki:logo.svg', ':logo.svg',
':wiki:logo.png', ':logo.png',
'images/logo.svg', 'images/logo.png'
], false, $logoSize);
// display logo and wiki title in a link to the home page
tpl_link(
wl(),
'<img src="' . $logo . '" ' . ($logoSize ? $logoSize[3] : '') . ' alt="" />' .
'<span>' . $conf['title'] . '</span>',
'accesskey="h" title="' . tpl_getLang('home') . ' [h]"'
);
?></h1>
<?php if ($conf['tagline']) : ?>
<p class="claim"><?php echo $conf['tagline']; ?></p>
<?php endif ?>
</div>
if ($logo === $templateLogoUrl) {
$logoMarkup = '<span class="logo__image logo__image--svg" aria-hidden="true">' .
inlineSVG($templateLogoPath) .
'</span>';
} else {
$logoMarkup = '<img src="' . $logo . '" ' . ($logoSize ? $logoSize[3] : '') . ' alt="" />';
}
<div class="tools group">
<!-- USER TOOLS -->
<?php if ($conf['useacl']) : ?>
<div id="dokuwiki__usertools">
<h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
<ul>
<?php
if (!empty($_SERVER['REMOTE_USER'])) {
echo '<li class="user">';
tpl_userinfo(); /* 'Logged in as ...' */
echo '</li>';
}
echo (new \dokuwiki\Menu\UserMenu())->getListItems('action ');
?>
</ul>
</div>
<?php endif ?>
tpl_link(
wl(),
$logoMarkup .
'<span>' . $conf['title'] . '</span>',
'accesskey="h" title="' . tpl_getLang('home') . ' [h]"'
);
?></h1>
<!-- SITE TOOLS -->
<div id="dokuwiki__sitetools">
<?php if ($breadcrumbsHtml) : ?>
<div class="breadcrumbs header__breadcrumbs"><?php echo $breadcrumbsHtml; ?></div>
<?php endif ?>
</div>
<div id="dokuwiki__sitetools" class="tools header__actions">
<h3 class="a11y"><?php echo $lang['site_tools']; ?></h3>
<?php tpl_searchform(true, false); ?>
<?php if ($siteToolsHtml || $userToolsHtml) : ?>
<details class="header__menu">
<summary aria-label="<?php echo hsc($lang['tools']); ?>" title="<?php echo hsc($lang['tools']); ?>">
<?php echo inlineSVG(DOKU_INC . 'lib/images/menu/settings.svg'); ?>
</summary>
<div class="header__menu-panel">
<?php if ($siteToolsHtml) : ?>
<ul class="header__menu-list header__menu-list--site">
<?php echo $siteToolsHtml; ?>
</ul>
<?php endif ?>
<?php if ($siteToolsHtml && $userToolsHtml) : ?>
<div class="header__menu-separator" role="separator"></div>
<?php endif ?>
<?php if ($userToolsHtml) : ?>
<div id="dokuwiki__usertools">
<h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
<ul class="header__menu-list header__menu-list--user">
<?php echo $userToolsHtml; ?>
</ul>
</div>
<?php endif ?>
</div>
</details>
<?php endif ?>
<div class="mobileTools">
<?php echo (new \dokuwiki\Menu\MobileMenu())->getDropdown($lang['tools']); ?>
</div>
<ul>
<?php echo (new \dokuwiki\Menu\SiteMenu())->getListItems('action '); ?>
</ul>
</div>
</div>
<!-- BREADCRUMBS -->
<?php if ($conf['breadcrumbs'] || $conf['youarehere']) : ?>
<div class="breadcrumbs">
<?php if ($conf['youarehere']) : ?>
<div class="youarehere"><?php tpl_youarehere() ?></div>
<?php endif ?>
<?php if ($conf['breadcrumbs']) : ?>
<div class="trace"><?php tpl_breadcrumbs() ?></div>
<?php endif ?>
</div>
<?php endif ?>
<hr class="a11y" />
</div></header><!-- /header -->