Use the default style's favicon in the admin panel
authorAlexander Ebert <ebert@woltlab.com>
Thu, 13 Dec 2018 14:21:41 +0000 (15:21 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 13 Dec 2018 14:21:41 +0000 (15:21 +0100)
See #2660

wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/lib/system/style/StyleHandler.class.php

index 5be17cdc4634a28fcea4270da1db9eed0cf9036b..1345af6914c0d53c36dfff792d31bebe45e3ecf5 100644 (file)
        {event name='stylesheets'}
        
        <!-- Icons -->
-       <link rel="apple-touch-icon" sizes="180x180" href="{@$__wcf->getPath()}images/favicon/default.apple-touch-icon.png">
-       <link rel="manifest" href="{@$__wcf->getPath()}images/favicon/default.manifest.json">
-       <link rel="shortcut icon" href="{@$__wcf->getPath()}images/favicon/default.favicon.ico">
-       <meta name="msapplication-config" content="{@$__wcf->getPath()}images/favicon/default.browserconfig.xml">
-       <meta name="theme-color" content="#3a6d9c">
+       {if PACKAGE_ID && $__wcf->getStyleHandler()->getDefaultStyle()}
+               <link rel="apple-touch-icon" sizes="180x180" href="{$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconAppleTouchIcon()}">
+               <link rel="manifest" href="{@$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconManifest()}">
+               <link rel="shortcut icon" href="{@$__wcf->getPath()}{@$__wcf->getStyleHandler()->getDefaultStyle()->getRelativeFavicon()}">
+               <meta name="msapplication-config" content="{@$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconBrowserconfig()}">
+               <meta name="theme-color" content="{$__wcf->getStyleHandler()->getDefaultStyle()->getVariable('wcfPageThemeColor', true)}">
+       {else}  
+               <link rel="apple-touch-icon" sizes="180x180" href="{@$__wcf->getP1ath()}images/favicon/default.apple-touch-icon.png">
+               <link rel="manifest" href="{@$__wcf->getPath()}images/favicon/default.manifest.json">
+               <link rel="shortcut icon" href="{@$__wcf->getPath()}images/favicon/default.favicon.ico">
+               <meta name="msapplication-config" content="{@$__wcf->getPath()}images/favicon/default.browserconfig.xml">
+               <meta name="theme-color" content="#3a6d9c">
+       {/if}
        
        <script>
                var SID_ARG_2ND = '';
index ea2e869dd87d90b3c386b76889869f3b0106fb36..160a471570618df19744079070d79b2c5fa98537 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\style\Style;
 use wcf\data\style\StyleEditor;
 use wcf\system\cache\builder\StyleCacheBuilder;
 use wcf\system\exception\SystemException;
+use wcf\system\request\RequestHandler;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 use wcf\util\JSON;
@@ -240,6 +241,25 @@ class StyleHandler extends SingletonFactory {
                return $this->icons;
        }
        
+       /**
+        * Retrieves the default style for requests originating from the ACP. May return `null`
+        * if there is no default style.
+        * 
+        * @return Style|null
+        */
+       public function getDefaultStyle() {
+               if (!RequestHandler::getInstance()->isACPRequest()) {
+                       throw new SystemException('Illegal request, please use `getStyle()` for frontend requests.');
+               }
+               
+               $styleID = $this->cache['default'];
+               if ($styleID) {
+                       return $this->cache['styles'][$styleID];
+               }
+               
+               return null;
+       }
+       
        /**
         * Reads the available icon names from the variable definition file.
         */