From d8240ca78215d4412202b1af6df19bcde627e5f6 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 16 Nov 2023 18:25:05 +0100 Subject: [PATCH] Allow to define default logo and favicon URL from config/core defaults --- src/Tpl.php | 14 ++++++++++++++ templates/empty.tpl | 4 ++-- templates/login.tpl | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Tpl.php b/src/Tpl.php index 6ecc9dd..c8bd4bb 100644 --- a/src/Tpl.php +++ b/src/Tpl.php @@ -110,6 +110,8 @@ class Tpl { 'webstats_js_code' => null, 'upload_max_filesize' => null, 'debug_ajax' => App::get('debug_ajax', false, 'bool'), + 'logo_url' => 'images/logo.svg', + 'favicon_url' => 'images/favicon.png', ) ); @@ -384,6 +386,18 @@ class Tpl { self :: assign('main_pagetitle', App::get('main_pagetitle', null, 'string')); self :: assign('session_key', isset($_SESSION['session_key'])?$_SESSION['session_key']:null); + $logo_url = App::get('templates.logo_url', null, 'string'); + self :: assign( + 'logo_url', + Url::is_absolute_url($logo_url)?$logo_url:self::static_url($logo_url) + ); + + $favicon_url = App::get('templates.favicon_url', null, 'string'); + self :: assign( + 'favicon_url', + Url::is_absolute_url($favicon_url)?$favicon_url:self::static_url($favicon_url) + ); + // Handle CSS & JS files included self :: add_css_file(App::get('templates.included_css_files', null, 'array')); self :: add_js_file(App::get('templates.included_js_files', null, 'array')); diff --git a/templates/empty.tpl b/templates/empty.tpl index f48495a..629a538 100644 --- a/templates/empty.tpl +++ b/templates/empty.tpl @@ -10,7 +10,7 @@ {block name="head"}{/block} - + {$main_pagetitle}{if $pagetitle} - {$pagetitle}{/if} @@ -36,7 +36,7 @@
{block name="navbar-brand"} - + {/block} diff --git a/templates/login.tpl b/templates/login.tpl index 91cae70..a3cc43a 100644 --- a/templates/login.tpl +++ b/templates/login.tpl @@ -7,7 +7,7 @@
{if !$include_navbar} - + {/if}

{t domain=$CORE_TEXT_DOMAIN}Sign in{/t}