mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°3363 - Add favicon in branding (#522)
This commit is contained in:
@@ -52,6 +52,8 @@ class Basic extends AbstractConfiguration
|
||||
$aPortalConf = $this->ParseGlobalProperties($aPortalConf);
|
||||
// - Rectifying portal logo url
|
||||
$aPortalConf = $this->AppendLogoUri($aPortalConf);
|
||||
// - Rectifying portal favicon url
|
||||
$aPortalConf = $this->AppendFavIconUri($aPortalConf);
|
||||
}
|
||||
catch (Exception $oException)
|
||||
{
|
||||
@@ -71,10 +73,11 @@ class Basic extends AbstractConfiguration
|
||||
{
|
||||
$aPortalConf = array(
|
||||
'properties' => array(
|
||||
'id' => $_ENV['PORTAL_ID'],
|
||||
'name' => 'Page:DefaultTitle',
|
||||
'logo' => Branding::GetPortalLogoAbsoluteUrl(),
|
||||
'themes' => array(
|
||||
'id' => $_ENV['PORTAL_ID'],
|
||||
'name' => 'Page:DefaultTitle',
|
||||
'logo' => Branding::GetPortalLogoAbsoluteUrl(),
|
||||
'favicon' => Branding::GetPortalFavIconAbsoluteUrl(),
|
||||
'themes' => array(
|
||||
'bootstrap' => 'itop-portal-base/portal/public/css/bootstrap-theme-combodo.scss',
|
||||
'portal' => 'itop-portal-base/portal/public/css/portal.scss',
|
||||
'others' => array(),
|
||||
@@ -116,11 +119,8 @@ class Basic extends AbstractConfiguration
|
||||
case 'name':
|
||||
case 'urlmaker_class':
|
||||
case 'triggers_query':
|
||||
$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText(
|
||||
$aPortalConf['properties'][$oPropertyNode->nodeName]
|
||||
);
|
||||
break;
|
||||
case 'logo':
|
||||
case 'favicon':
|
||||
$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText(
|
||||
$aPortalConf['properties'][$oPropertyNode->nodeName]
|
||||
);
|
||||
@@ -263,8 +263,7 @@ class Basic extends AbstractConfiguration
|
||||
private function AppendLogoUri(array $aPortalConf)
|
||||
{
|
||||
$sLogoUri = $aPortalConf['properties']['logo'];
|
||||
if (!preg_match('/^http/', $sLogoUri))
|
||||
{
|
||||
if (!preg_match('/^http/', $sLogoUri)) {
|
||||
// We prefix it with the server base url
|
||||
$sLogoUri = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/'.$sLogoUri;
|
||||
}
|
||||
@@ -272,4 +271,23 @@ class Basic extends AbstractConfiguration
|
||||
|
||||
return $aPortalConf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aPortalConf
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @since 3.2.0 N°3363
|
||||
*/
|
||||
private function AppendFaviconUri(array $aPortalConf)
|
||||
{
|
||||
$sFaviconUri = $aPortalConf['properties']['favicon'];
|
||||
if (!preg_match('/^http/', $sFaviconUri)) {
|
||||
// We prefix it with the server base url
|
||||
$sFaviconUri = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/'.$sFaviconUri;
|
||||
}
|
||||
$aPortalConf['properties']['favicon'] = $sFaviconUri;
|
||||
|
||||
return $aPortalConf;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
{% block pPageExtraMetas %}
|
||||
{% endblock %}
|
||||
<title>{% block pPageTitle %}{% if sPageTitle is defined and sPageTitle is not null %}{{ sPageTitle }} - {{ constant('ITOP_APPLICATION_SHORT') }}{% else %}{{ 'Page:DefaultTitle'|dict_format(constant('ITOP_APPLICATION_SHORT')) }}{% endif %}{% endblock %}</title>
|
||||
<link rel="shortcut icon" href="{{ app['combodo.absolute_url'] ~ 'images/favicon.ico'|add_itop_version }}" />
|
||||
<link rel="shortcut icon" href="{{ app['combodo.portal.instance.conf'].properties.favicon|add_itop_version }}"/>
|
||||
|
||||
{% block pPageStylesheets %}
|
||||
{# First bootstrap core, lib themes, then bootstrap theme, portal adjustements #}
|
||||
|
||||
Reference in New Issue
Block a user