Allow to define default logo and favicon URL from config/core defaults

This commit is contained in:
Benjamin Renard 2023-11-16 18:25:05 +01:00
parent ea66e9d217
commit d8240ca782
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
3 changed files with 17 additions and 3 deletions

View file

@ -110,6 +110,8 @@ class Tpl {
'webstats_js_code' => null, 'webstats_js_code' => null,
'upload_max_filesize' => null, 'upload_max_filesize' => null,
'debug_ajax' => App::get('debug_ajax', false, 'bool'), '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('main_pagetitle', App::get('main_pagetitle', null, 'string'));
self :: assign('session_key', isset($_SESSION['session_key'])?$_SESSION['session_key']:null); 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 // Handle CSS & JS files included
self :: add_css_file(App::get('templates.included_css_files', null, 'array')); self :: add_css_file(App::get('templates.included_css_files', null, 'array'));
self :: add_js_file(App::get('templates.included_js_files', null, 'array')); self :: add_js_file(App::get('templates.included_js_files', null, 'array'));

View file

@ -10,7 +10,7 @@
<base href="{$public_root_url}/"/> <base href="{$public_root_url}/"/>
{block name="head"}{/block} {block name="head"}{/block}
<link rel="icon" href="{static_url path="images/favicon.png"}"/> <link rel="icon" href="{$favicon_url}"/>
<title>{$main_pagetitle}{if $pagetitle} - {$pagetitle}{/if}</title> <title>{$main_pagetitle}{if $pagetitle} - {$pagetitle}{/if}</title>
@ -36,7 +36,7 @@
<div class="{block name="navbar-container-class"}container{/block}"> <div class="{block name="navbar-container-class"}container{/block}">
{block name="navbar-brand"} {block name="navbar-brand"}
<a class="navbar-brand me-3" href="#"> <a class="navbar-brand me-3" href="#">
<img id="logo" src="{static_url path="images/logo.svg"}" alt="Logo" title="Logo"/> <img id="logo" src="{$logo_url}" alt="Logo" title="Logo"/>
</a> </a>
{/block} {/block}

View file

@ -7,7 +7,7 @@
<main class="form-signin w-100 m-auto text-center"> <main class="form-signin w-100 m-auto text-center">
<form action="login" method="POST"> <form action="login" method="POST">
{if !$include_navbar} {if !$include_navbar}
<img class="mb-4" src="{static_url path="images/logo.svg"}" alt="" width="100"> <img class="mb-4" src="{$logo_url}" alt="" width="100">
{/if} {/if}
<h1 class="h3 mb-3 fw-normal">{t domain=$CORE_TEXT_DOMAIN}Sign in{/t}</h1> <h1 class="h3 mb-3 fw-normal">{t domain=$CORE_TEXT_DOMAIN}Sign in{/t}</h1>