Pārlūkot izejas kodu

logo admin

feature/symfony6.1
Charly pirms 2 gadiem
vecāks
revīzija
d9680fbf9c
5 mainītis faili ar 56 papildinājumiem un 51 dzēšanām
  1. +0
    -2
      Controller/Dashboard/DashboardAdminController.php
  2. +0
    -5
      Controller/Security/SecurityAdminController.php
  3. +4
    -1
      Resources/config/services.yaml
  4. +1
    -2
      Resources/views/adminlte/layout.html.twig
  5. +51
    -41
      Twig/TwigExtension.php

+ 0
- 2
Controller/Dashboard/DashboardAdminController.php Parādīt failu

@@ -29,8 +29,6 @@ class DashboardAdminController extends AbstractDashboardController
return Dashboard::new()
// the name visible to end users
->setTitle('LA CLIC !')
// you can include HTML contents too (e.g. to link to an image)
->setTitle('<img src="assets/img/'.$this->get('parameter_bag')->get('app.admin.logo').'" width="100px">')
// the path defined in this method is passed to the Twig asset() function
->setFaviconPath('assets/img/frontend/favicon-pdl.png')
// the domain used by default is 'messages'

+ 0
- 5
Controller/Security/SecurityAdminController.php Parādīt failu

@@ -37,11 +37,6 @@ class SecurityAdminController extends AbstractController
// the same domain as the rest of the Dashboard)
'translation_domain' => 'admin',

// the title visible above the login form (define this option only if you are
// rendering the login template in a regular Symfony controller; when rendering
// it from an EasyAdmin Dashboard this is automatically set as the Dashboard title)
'page_title' => '<img src="assets/img/' . $this->get('parameter_bag')->get('app.admin.logo') . '" >',

// the string used to generate the CSRF token. If you don't define
// this parameter, the login form won't include a CSRF token
'csrf_token_intention' => 'authenticate',

+ 4
- 1
Resources/config/services.yaml Parādīt failu

@@ -38,4 +38,7 @@ services:

Lc\SovBundle\EventListener\ExceptionListener:
tags:
- { name: kernel.event_listener, event: kernel.exception }
- { name: kernel.event_listener, event: kernel.exception }

parameters:
app.admin.logo: 'laclic.png'

+ 1
- 2
Resources/views/adminlte/layout.html.twig Parādīt failu

@@ -89,8 +89,7 @@
<a class="brand-link text-center"
title="{{ ea.dashboardTitle|striptags }}"
href="{{ path(ea.dashboardRouteName) }}">
{{ ea.dashboardTitle|raw }}
<!--<span class="brand-text font-weight-light">Texte logo</span>-->
{{ logo_admin()|raw }}
</a>
{% endblock header_logo %}


+ 51
- 41
Twig/TwigExtension.php Parādīt failu

@@ -47,22 +47,22 @@ class TwigExtension extends AbstractExtension
protected AdminUrlGenerator $adminUrlGenerator;

public function __construct(
KernelInterface $kernel,
ParameterBagInterface $parameterBag,
CacheManager $cacheManager,
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin,
ReminderStore $reminderStore,
Security $security,
FormFactoryInterface $formFactory,
StringComponent $stringComponent,
MetaComponent $metaComponent,
DateComponent $dateComponent,
FileComponent $fileComponent,
AdminUrlGenerator $adminUrlGenerator
KernelInterface $kernel,
ParameterBagInterface $parameterBag,
CacheManager $cacheManager,
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin,
ReminderStore $reminderStore,
Security $security,
FormFactoryInterface $formFactory,
StringComponent $stringComponent,
MetaComponent $metaComponent,
DateComponent $dateComponent,
FileComponent $fileComponent,
AdminUrlGenerator $adminUrlGenerator
) {
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
@@ -85,19 +85,20 @@ class TwigExtension extends AbstractExtension
public function getFunctions()
{
return [
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
new TwigFunction('lc_format_price', [$this, 'formatPrice']),
new TwigFunction('die', [$this, 'die']),
new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']),
new TwigFunction('sov_limit_text', [$this, 'limitText']),
new TwigFunction('day_by_number', [$this, 'getDayByNumber']),
new TwigFunction('user_current', [$this, 'getUserCurrent']),
new TwigFunction('ea_url_short', [$this, 'generateEaUrl']),
new TwigFunction('is_instance_of', [$this, 'isInstanceOf']),
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
new TwigFunction('lc_format_price', [$this, 'formatPrice']),
new TwigFunction('die', [$this, 'die']),
new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']),
new TwigFunction('sov_limit_text', [$this, 'limitText']),
new TwigFunction('day_by_number', [$this, 'getDayByNumber']),
new TwigFunction('user_current', [$this, 'getUserCurrent']),
new TwigFunction('ea_url_short', [$this, 'generateEaUrl']),
new TwigFunction('is_instance_of', [$this, 'isInstanceOf']),
new TwigFunction('logo_admin', [$this, 'getLogoAdmin']),
];
}

@@ -109,12 +110,12 @@ class TwigExtension extends AbstractExtension
public function getFilters()
{
return [
new TwigFilter('uc_first', [$this, 'ucFirst']),
new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']),
new TwigFilter('rot13', [$this, 'rot13']),
new TwigFilter('uc_first', [$this, 'ucFirst']),
new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']),
new TwigFilter('rot13', [$this, 'rot13']),
];
}

@@ -128,8 +129,8 @@ class TwigExtension extends AbstractExtension
$reflection = new \ReflectionClass($entity);
$interfaceNameArray = $reflection->getInterfaceNames();

foreach($interfaceNameArray as $interfaceNameEntity) {
if(strpos($interfaceNameEntity, $interfaceName) !== false) {
foreach ($interfaceNameArray as $interfaceNameEntity) {
if (strpos($interfaceNameEntity, $interfaceName) !== false) {
return true;
}
}
@@ -207,8 +208,12 @@ class TwigExtension extends AbstractExtension
return $this->security->getUser();
}

public function generateEaUrl(string $controller =null, string $action=null, int $entityId=null, array $extraParam = array()): string
{
public function generateEaUrl(
string $controller = null,
string $action = null,
int $entityId = null,
array $extraParam = array()
): string {
$adminUrlGenerator = $this->adminUrlGenerator;

if ($controller) {
@@ -220,8 +225,8 @@ class TwigExtension extends AbstractExtension

$adminUrlGenerator->setEntityId($entityId);

if($extraParam){
foreach ($extraParam as $key=>$value) {
if ($extraParam) {
foreach ($extraParam as $key => $value) {
$adminUrlGenerator->set($key, $value);
}
}
@@ -232,4 +237,9 @@ class TwigExtension extends AbstractExtension
{
return md5($text);
}

public function getLogoAdmin(): string
{
return '<img class="logo-admin" src="assets/img/' . $this->getParameter('app.admin.logo') . '" >';
}
}

Notiek ielāde…
Atcelt
Saglabāt