Commit 8798f1ce by Damien Moulard

personnalisation logo & favicon

parent 87393dda
......@@ -39,3 +39,9 @@ yarn-error.log
###> payum ###
/transactions/
###< payum ###
###> ui customization ###
/public/images/logo-custom.png
/public/images/favicon-custom/*.png
/public/images/favicon-custom/*.ico
###< payum ###
{
"lang" : "fr",
"dir" : "ltr",
"name" : "Kohinos : Outil de gestion de MLCC",
"short_name" : "kohinos",
"icons" : [
{
"src" : "/images/favicon-custom/android-chrome-192x192.png",
"sizes" : "192x192",
"type" : "image/png"
},
{
"src" : "/images/favicon-custom/android-chrome-144x144.png",
"sizes" : "144x144",
"type" : "image/png"
},
{
"src" : "/images/favicon-custom/android-chrome-96x96.png",
"sizes" : "96x96",
"type" : "image/png"
},
{
"src" : "/images/favicon-custom/android-chrome-48x48.png",
"sizes" : "48x48",
"type" : "image/png"
}
],
"theme_color" : "#ffffff",
"background_color" : "#ffffff",
"start_url" : "/",
"display" : "standalone",
"orientation" : "natural"
}
......@@ -63,10 +63,32 @@ class AppExtension extends AbstractExtension
new \Twig_SimpleFunction('parameter', function ($name) {
return $this->container->getParameter($name);
}),
new \Twig_SimpleFunction('isPayzenEnabled', array($this, 'isPayzenEnabled'))
new \Twig_SimpleFunction('isPayzenEnabled', array($this, 'isPayzenEnabled')),
new \Twig_SimpleFunction('isCustomLogo', array($this, 'isCustomLogo')),
new \Twig_SimpleFunction('getFaviconPath', array($this, 'getFaviconPath'))
];
}
public function getFaviconPath()
{
$appPath = $this->container->getParameter('kernel.project_dir');
$dirPath = $appPath . '/public/images/favicon-custom/';
$filePath = $dirPath . '/favicon-32x32.png';
if (is_dir($dirPath) && file_exists($filePath)) {
return "/images/favicon-custom/";
} else {
return "/images/favicon/";
}
}
public function isCustomLogo()
{
$appPath = $this->container->getParameter('kernel.project_dir');
$filename = $appPath . '/public/images/logo-custom.png';
return file_exists($filename);
}
public function isPayzenEnabled()
{
return $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_PAYZEN) === 'true' ? true : false;
......
<header class="container header">
<nav class="menu navbar navbar-expand-md navbar-light bg-light">
<a class="navbar-brand" href="{{ url('index') }}">
<img src="/images/logo.png" height="45" class="d-inline-block align-top" alt="{{ KOH_MLC_NAME|default('') }}">
{% if isCustomLogo() %}
<img src="/images/logo-custom.png" height="45" class="d-inline-block align-top" alt="{{ KOH_MLC_NAME|default('') }}">
{% else %}
<img src="/images/logo.png" height="45" class="d-inline-block align-top" alt="{{ KOH_MLC_NAME|default('') }}">
{% endif %}
</a>
{% block menu %}
......
......@@ -16,10 +16,11 @@
{# FAVICON #}
{% block favicon %}
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/images/favicon/site.webmanifest">
{% set favPath = getFaviconPath() %}
<link rel="apple-touch-icon" sizes="180x180" href="{{ favPath }}apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ favPath }}favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ favPath }}favicon-16x16.png">
<link rel="manifest" href="{{ favPath }}site.webmanifest">
{% endblock favicon %}
{# POUR AJOUTER DES META ( like og: ) #}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment