From ecb58f988a70242e86e32e8d84bf2c37fde45b34 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 24 Jul 2020 14:35:34 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1206 --- .../AdminTheme/AdminThemeUikit/AdminThemeUikit.module | 8 +++++++- wire/modules/AdminTheme/AdminThemeUikit/_masthead.php | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wire/modules/AdminTheme/AdminThemeUikit/AdminThemeUikit.module b/wire/modules/AdminTheme/AdminThemeUikit/AdminThemeUikit.module index b55d2fd4..a0bc7f0b 100644 --- a/wire/modules/AdminTheme/AdminThemeUikit/AdminThemeUikit.module +++ b/wire/modules/AdminTheme/AdminThemeUikit/AdminThemeUikit.module @@ -967,6 +967,7 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl * - `getURL` (bool): Return only the URL? (default=false) * - `getNative` (bool): Return only the ProcessWire brand logo? (default=false) * - `alt` (string): Alt attribute for tag (default=auto) + * - `height` (string): Height style to use for SVG images (default='') * @return string * */ @@ -981,10 +982,12 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl 'getURL' => false, 'getNative' => false, 'alt' => '', + 'height' => '', ); $options = array_merge($defaults, $options); $logoURL = $this->get('logoURL'); + $svg = false; if(empty($logoURL) || $options['getNative'] || strpos($logoURL, '//') !== false) { $native = true; @@ -993,6 +996,7 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl $logoURL = $config->urls->root . ltrim($logoURL, '/'); $logoURL = $sanitizer->entities($logoURL); $native = false; + $svg = strtolower(pathinfo($logoURL, PATHINFO_EXTENSION)) === 'svg'; } if($options['getURL']) return $logoURL; @@ -1002,7 +1006,9 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl $alt = "ProcessWire $config->version"; } $class = 'pw-logo ' . ($native ? 'pw-logo-native' : 'pw-logo-custom'); - $img = "$alt"; + $attr = "class='$class' src='$logoURL' alt='$alt' "; + if($svg && $options['height']) $attr .= "style='height:$options[height]' "; + $img = ""; return $img; } diff --git a/wire/modules/AdminTheme/AdminThemeUikit/_masthead.php b/wire/modules/AdminTheme/AdminThemeUikit/_masthead.php index 8c5461bc..aa54770a 100644 --- a/wire/modules/AdminTheme/AdminThemeUikit/_masthead.php +++ b/wire/modules/AdminTheme/AdminThemeUikit/_masthead.php @@ -9,12 +9,14 @@ if(!defined("PROCESSWIRE")) die(); /** @var Config $config */ /** @var Notices $notices */ +$logoOptions = array('height' => '40px'); + ?>
@@ -23,7 +25,7 @@ if(!defined("PROCESSWIRE")) die();