1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00
This commit is contained in:
Ryan Cramer
2020-07-24 14:35:34 -04:00
parent 88437e42cc
commit ecb58f988a
2 changed files with 11 additions and 3 deletions

View File

@@ -967,6 +967,7 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
* - `getURL` (bool): Return only the URL? (default=false) * - `getURL` (bool): Return only the URL? (default=false)
* - `getNative` (bool): Return only the ProcessWire brand logo? (default=false) * - `getNative` (bool): Return only the ProcessWire brand logo? (default=false)
* - `alt` (string): Alt attribute for <img> tag (default=auto) * - `alt` (string): Alt attribute for <img> tag (default=auto)
* - `height` (string): Height style to use for SVG images (default='')
* @return string * @return string
* *
*/ */
@@ -981,10 +982,12 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
'getURL' => false, 'getURL' => false,
'getNative' => false, 'getNative' => false,
'alt' => '', 'alt' => '',
'height' => '',
); );
$options = array_merge($defaults, $options); $options = array_merge($defaults, $options);
$logoURL = $this->get('logoURL'); $logoURL = $this->get('logoURL');
$svg = false;
if(empty($logoURL) || $options['getNative'] || strpos($logoURL, '//') !== false) { if(empty($logoURL) || $options['getNative'] || strpos($logoURL, '//') !== false) {
$native = true; $native = true;
@@ -993,6 +996,7 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
$logoURL = $config->urls->root . ltrim($logoURL, '/'); $logoURL = $config->urls->root . ltrim($logoURL, '/');
$logoURL = $sanitizer->entities($logoURL); $logoURL = $sanitizer->entities($logoURL);
$native = false; $native = false;
$svg = strtolower(pathinfo($logoURL, PATHINFO_EXTENSION)) === 'svg';
} }
if($options['getURL']) return $logoURL; if($options['getURL']) return $logoURL;
@@ -1002,7 +1006,9 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
$alt = "ProcessWire $config->version"; $alt = "ProcessWire $config->version";
} }
$class = 'pw-logo ' . ($native ? 'pw-logo-native' : 'pw-logo-custom'); $class = 'pw-logo ' . ($native ? 'pw-logo-native' : 'pw-logo-custom');
$img = "<img class='$class' src='$logoURL' alt='$alt' />"; $attr = "class='$class' src='$logoURL' alt='$alt' ";
if($svg && $options['height']) $attr .= "style='height:$options[height]' ";
$img = "<img $attr/>";
return $img; return $img;
} }

View File

@@ -9,12 +9,14 @@ if(!defined("PROCESSWIRE")) die();
/** @var Config $config */ /** @var Config $config */
/** @var Notices $notices */ /** @var Notices $notices */
$logoOptions = array('height' => '40px');
?> ?>
<div id='pw-mastheads'> <div id='pw-mastheads'>
<header id='pw-masthead-mobile' class='pw-masthead uk-hidden uk-background-muted'> <header id='pw-masthead-mobile' class='pw-masthead uk-hidden uk-background-muted'>
<div class='pw-container uk-container uk-container-expand<?php if(!$adminTheme->isLoggedIn) echo ' uk-text-center'; ?>'> <div class='pw-container uk-container uk-container-expand<?php if(!$adminTheme->isLoggedIn) echo ' uk-text-center'; ?>'>
<a href='<?php echo $adminTheme->isLoggedIn ? $config->urls->admin : $config->urls->root; ?>' class='pw-logo-link'> <a href='<?php echo $adminTheme->isLoggedIn ? $config->urls->admin : $config->urls->root; ?>' class='pw-logo-link'>
<?php echo $adminTheme->getLogo(); ?> <?php echo $adminTheme->getLogo($logoOptions); ?>
</a> </a>
</div> </div>
</header> </header>
@@ -23,7 +25,7 @@ if(!defined("PROCESSWIRE")) die();
<nav class='uk-navbar uk-navbar-container uk-navbar-transparent' uk-navbar> <nav class='uk-navbar uk-navbar-container uk-navbar-transparent' uk-navbar>
<div class='uk-navbar-left'> <div class='uk-navbar-left'>
<a class="pw-logo-link uk-logo uk-margin-right" href='<?php echo $adminTheme->isLoggedIn ? $config->urls->admin : $config->urls->root; ?>'> <a class="pw-logo-link uk-logo uk-margin-right" href='<?php echo $adminTheme->isLoggedIn ? $config->urls->admin : $config->urls->root; ?>'>
<?php echo $adminTheme->getLogo(); ?> <?php echo $adminTheme->getLogo($logoOptions); ?>
</a> </a>
<?php if($adminTheme->isLoggedIn): ?> <?php if($adminTheme->isLoggedIn): ?>
<ul class='uk-navbar-nav pw-primary-nav'> <ul class='uk-navbar-nav pw-primary-nav'>