Parcourir la source

File manager & image manager

tags/0.1
Fab il y a 3 ans
Parent
révision
a6ac1f426a
24 fichiers modifiés avec 601 ajouts et 208 suppressions
  1. +41
    -15
      Controller/Admin/AbstractCrudController.php
  2. +1
    -1
      Controller/Admin/DashboardController.php
  3. +6
    -3
      Controller/Admin/UserController.php
  4. +6
    -6
      EventSubscriber/EasyAdminEventSubscriber.php
  5. +2
    -0
      Field/FileManagerField.php
  6. +2
    -0
      Field/ImageManagerField.php
  7. +11
    -7
      Form/Type/User/ChangePasswordFormType.php
  8. +16
    -24
      Form/Type/User/ProfileFormType.php
  9. +0
    -3
      Resources/assets/app/adminlte/field/collection/app.collection.js
  10. +2
    -0
      Resources/assets/app/adminlte/field/filemanager/app.filemanager.js
  11. +79
    -5
      Resources/translations/admin.fr.yaml
  12. +2
    -1
      Resources/views/adminlte/block/menu.html.twig
  13. +6
    -5
      Resources/views/adminlte/crud/action/translatable.html.twig
  14. +1
    -5
      Resources/views/adminlte/crud/edit.html.twig
  15. +132
    -35
      Resources/views/adminlte/crud/form_theme.html.twig
  16. +4
    -5
      Resources/views/adminlte/crud/index.html.twig
  17. +1
    -6
      Resources/views/adminlte/crud/new.html.twig
  18. +1
    -2
      Resources/views/adminlte/crud/sort.html.twig
  19. +3
    -1
      Resources/views/adminlte/dashboard.html.twig
  20. +9
    -7
      Resources/views/adminlte/layout.html.twig
  21. +1
    -1
      Resources/views/user/change_password.html.twig
  22. +1
    -1
      Resources/views/user/profile.html.twig
  23. +145
    -0
      Translation/TranslatorAdmin.php
  24. +129
    -75
      Twig/TwigExtension.php

+ 41
- 15
Controller/Admin/AbstractCrudController.php Voir le fichier

@@ -40,6 +40,7 @@ use Lc\SovBundle\Doctrine\Extension\TreeInterface;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\GalleryManagerField;
use Lc\SovBundle\Form\Type\Crud\PositionType;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -51,13 +52,20 @@ abstract class AbstractCrudController extends EaAbstractCrudController
{
protected $session;
protected $request;

public function __construct(SessionInterface $session, RequestStack $request, EntityManager $em, Environment $twig)
{
protected $translatorAdmin;

public function __construct(
SessionInterface $session,
RequestStack $request,
EntityManager $em,
Environment $twig,
TranslatorAdmin $translatorAdmin
) {
$this->session = $session;
$this->request = $request;
$this->em = $em;
$this->twig = $twig;
$this->translatorAdmin = $translatorAdmin;
}

public function configureActions(Actions $actions): Actions
@@ -79,22 +87,27 @@ abstract class AbstractCrudController extends EaAbstractCrudController
$actionsArray[Crud::PAGE_INDEX] = [
Action::NEW => [
'icon' => 'plus',
'label' => 'Créer',
'label' => $this->translatorAdmin->transAction('create'),
'add_class' => 'btn-sm'
],
Action::EDIT => [
'class' => 'btn btn-sm btn-primary',
'icon' => 'edit',
'label' => false,
'html_attributes' => array('data-toggle' => 'tooltip', 'title' => 'Éditer')
'html_attributes' => array(
'data-toggle' => 'tooltip',
'title' => $this->translatorAdmin->transAction('edit')
)
],
Action::DELETE => [
'icon' => 'trash',
'dropdown' => true,
'label' => $this->translatorAdmin->transAction('delete')
],
Action::BATCH_DELETE => [
'class' => 'btn btn-sm btn-danger',
'icon' => 'trash',
'label' => $this->translatorAdmin->transAction('delete')
],
];

@@ -103,19 +116,23 @@ abstract class AbstractCrudController extends EaAbstractCrudController
$actionSaveAndReturn = [
'add_class' => 'float-right',
'icon' => 'check',
'label' => $this->translatorAdmin->transAction('save_and_return')
];
$actionIndex = [
'icon' => 'chevron-left',
'class' => 'btn btn-link',
'label' => $this->translatorAdmin->transAction('back_index')
];

$actionsArray[Crud::PAGE_EDIT] = [
Action::SAVE_AND_CONTINUE => [
'class' => 'btn btn-info float-right',
'label' => $this->translatorAdmin->transAction('save_and_continue')
],
Action::DELETE => [
'icon' => 'trash',
'class' => 'btn btn-outline-danger action-delete',
'label' => $this->translatorAdmin->transAction('delete')
],
Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX => $actionIndex,
@@ -124,6 +141,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController
$actionsArray[Crud::PAGE_NEW] = [
Action::SAVE_AND_ADD_ANOTHER => [
'class' => 'btn btn-info float-right',
'label' => $this->translatorAdmin->transAction('save_and_add_another')
],
Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX => $actionIndex,
@@ -134,7 +152,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController
$actions->add(Crud::PAGE_NEW, Action::INDEX);

if ($this->isInstanceOf(SortableInterface::class)) {
$sortAction = Action::new('sort', 'Ordonner', 'fa fa-sort')
$sortAction = Action::new('sort', $this->translatorAdmin->transAction('sort'), 'fa fa-sort')
->linkToCrudAction('sort')
->setCssClass('btn btn-sm btn-success')
->createAsGlobalAction();
@@ -144,14 +162,22 @@ abstract class AbstractCrudController extends EaAbstractCrudController


if ($this->isInstanceOf(TreeInterface::class)) {
$indexChildAction = Action::new('index_children', 'Afficher les enfants', 'fa fa-list')
$indexChildAction = Action::new(
'index_children',
$this->translatorAdmin->transAction('index_children'),
'fa fa-list'
)
->linkToCrudAction(Action::INDEX)
->setLabel('')
->setHtmlAttributes(array('data-toggle' => 'tooltip', 'title' => 'Afficher les enfants'))
->setTemplatePath('@LcSov/adminlte/crud/action/index_children.html.twig')
->setCssClass('btn btn-sm btn-success');

$backParentAction = Action::new('index_parent', 'Retour au parent', 'fa fa-chevron-left')
$backParentAction = Action::new(
'index_parent',
$this->translatorAdmin->transAction('index_parent'),
'fa fa-chevron-left'
)
->linkToCrudAction(Action::INDEX)
->setCssClass('btn btn-sm btn-info')
->createAsGlobalAction();
@@ -205,6 +231,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{
// fields sur la page index
if (Crud::PAGE_INDEX === $responseParameters->get('pageName')) {
$responseParameters->set('fields', $this->configureFields('index'));
}
@@ -244,7 +271,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController
{
if ($this->isInstanceOf(SortableInterface::class)) {
$seoPanel = [
FormField::addPanel('Seo')->setTemplateName('crud/field/generic'),
FormField::addPanel('seo')->setTemplateName('crud/field/generic'),
TextField::new('metaTitle')->setLabel('Meta Title')->setHelp(
'Affiché dans les résultats de recherche Google'
)->hideOnIndex(),
@@ -260,7 +287,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController

if ($this->isInstanceOf(DevAliasInterface::class)) {
$confPanel = [
FormField::addPanel('Conf')->setTemplateName('crud/field/generic'),
FormField::addPanel('configuration')->setTemplateName('crud/field/generic'),
TextField::new('devAlias')->hideOnIndex(),
];
}
@@ -306,7 +333,6 @@ abstract class AbstractCrudController extends EaAbstractCrudController
->getForm();

$entityManager = $this->getDoctrine()->getManagerForClass($this->getEntityFqcn());
dump($entityManager);
$repository = $entityManager->getRepository($this->getEntityFqcn());

$sortableForm->handleRequest($context->getRequest());
@@ -333,7 +359,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController
$url = $this->get(AdminUrlGenerator::class)
->setAction(Action::INDEX)
->generateUrl();
$this->addFlash('success', 'Position modifié', array());
$this->addFlash('success', $this->translatorAdmin->transFlashMessage('sort'), array());

return $this->redirect($url);
}
@@ -418,14 +444,14 @@ abstract class AbstractCrudController extends EaAbstractCrudController

public function edit(AdminContext $context)
{
$response = parent::edit($context); ;
$response = parent::edit($context);;

// on vide le flash bag si édition en ajax (notification déjà affichée en Javascript)
if ($context->getRequest()->isXmlHttpRequest()) {
$this->session->getFlashBag()->clear() ;
$this->session->getFlashBag()->clear();
}

return $response ;
return $response;
}

public function isInstanceOf(string $interfaceName): bool

+ 1
- 1
Controller/Admin/DashboardController.php Voir le fichier

@@ -30,7 +30,7 @@ class DashboardController extends AbstractDashboardController
// the path defined in this method is passed to the Twig asset() function
->setFaviconPath('favicon.svg')
// the domain used by default is 'messages'
->setTranslationDomain('lcadmin');
->setTranslationDomain('admin');
}

public function configureAssets(): Assets

+ 6
- 3
Controller/Admin/UserController.php Voir le fichier

@@ -2,9 +2,12 @@

namespace Lc\SovBundle\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Form\Type\User\ChangePasswordFormType;
use Lc\SovBundle\Form\Type\User\ProfileFormType;
use Lc\SovBundle\Model\User\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -12,7 +15,6 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;

class UserController extends AbstractController
{

protected $em;

public function __construct(EntityManager $em)
@@ -37,7 +39,7 @@ class UserController extends AbstractController
return $this->render(
'@LcSov/user/profile.html.twig',
[
'form' => $form->createView()
'form' => $form->createView(),
]
);
}
@@ -52,7 +54,7 @@ class UserController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$user = $form->getData();

$plainPassword = $form->get('plainPassword')->getData();
$plainPassword = $form->get('plain_password')->getData();

// @TODO : créer UserManager
$newPasswordEncoded = $passwordEncoder->encodePassword($user, $plainPassword);
@@ -65,6 +67,7 @@ class UserController extends AbstractController
return $this->render(
'@LcSov/user/change_password.html.twig',
[
'entity_class' => User::class,
'form' => $form->createView()
]
);

+ 6
- 6
EventSubscriber/EasyAdminEventSubscriber.php Voir le fichier

@@ -29,22 +29,22 @@ class EasyAdminEventSubscriber implements EventSubscriberInterface

public function flashMessageAfterPersist(AfterEntityPersistedEvent $event): void
{
$this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.create', [
$this->session->getFlashBag()->add('success', new TranslatableMessage('flash_message.create', [
'%name%' => (string) $event->getEntityInstance(),
], 'admin'));
]));
}

public function flashMessageAfterUpdate(AfterEntityUpdatedEvent $event): void
{
$this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.update', [
$this->session->getFlashBag()->add('success', new TranslatableMessage('flash_message.update', [
'%name%' => (string) $event->getEntityInstance(),
], 'admin'));
]));
}

public function flashMessageAfterDelete(AfterEntityDeletedEvent $event): void
{
$this->session->getFlashBag()->add('success', new TranslatableMessage('content_admin.flash_message.delete', [
$this->session->getFlashBag()->add('success', new TranslatableMessage('flash_message.delete', [
'%name%' => (string) $event->getEntityInstance(),
], 'admin'));
]));
}
}

+ 2
- 0
Field/FileManagerField.php Voir le fichier

@@ -24,6 +24,8 @@ final class FileManagerField implements FieldInterface
->setLabel($label)
->setTemplatePath('@LcSov/adminlte/crud/field/file.html.twig')
->addWebpackEncoreEntries('adminlte-field-filemanager')
->setCustomOption('managerDir', 'file')
->setCustomOption('type', 'file')
->setFormType(FileManagerType::class)
->addCssClass('field-text')
->setCustomOption(self::OPTION_MAX_LENGTH, null)

+ 2
- 0
Field/ImageManagerField.php Voir le fichier

@@ -25,6 +25,8 @@ final class ImageManagerField implements FieldInterface
->setTemplatePath('@LcSov/adminlte/crud/field/image.html.twig')
->addWebpackEncoreEntries('adminlte-field-filemanager')
->setFormType(FileManagerType::class)
->setCustomOption('managerDir', 'image')
->setCustomOption('type', 'image')
->addCssClass('field-text')
->setCustomOption(self::OPTION_MAX_LENGTH, null)
->setCustomOption(self::OPTION_RENDER_AS_HTML, false);

+ 11
- 7
Form/Type/User/ChangePasswordFormType.php Voir le fichier

@@ -13,6 +13,7 @@ namespace Lc\SovBundle\Form\Type\User;

use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
@@ -20,16 +21,19 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Component\Validator\Constraints\NotBlank;

class ChangePasswordFormType extends AbstractType
{

protected $em ;
protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em)
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em ;
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

/**
@@ -49,7 +53,7 @@ class ChangePasswordFormType extends AbstractType
'current_password',
PasswordType::class,
[
'label' => 'Mot de passe actuel',
'label' => 'form.change_password.current_password',
'mapped' => false,
'constraints' => [
new NotBlank(),
@@ -64,8 +68,8 @@ class ChangePasswordFormType extends AbstractType
[
'type' => PasswordType::class,
'mapped' => false,
'first_options' => ['label' => 'Nouveau mot de passe'],
'second_options' => ['label' => 'Nouveau mot de passe (confirmation)'],
'first_options' => ['label' => 'form.change_password.new_password'],
'second_options' => ['label' => 'form.change_password.new_password_repeat'],
'invalid_message' => 'Les deux mots de passe ne correspondent pas.',
]
);
@@ -74,7 +78,7 @@ class ChangePasswordFormType extends AbstractType
'submit',
SubmitType::class,
array(
'label' => 'Sauvegarder'
'label' => $this->translatorAdmin->transAction('save')
)
);
}

+ 16
- 24
Form/Type/User/ProfileFormType.php Voir le fichier

@@ -6,66 +6,58 @@ use Lc\SovBundle\DataTransformer\FileManagerTypeToDataTransformer;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatableMessage;

class ProfileFormType extends AbstractType
{
protected $em ;
protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em)
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em ;
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$entityName = $this->em->getEntityName(UserInterface::class) ;
$entityName = $this->em->getEntityName(UserInterface::class);

$builder->add(
'firstname',
TextType::class,
array(
'label' => 'Prénom'
)
TextType::class
);

$builder->add(
'lastname',
TextType::class,
array(
'label' => 'Nom'
)
TextType::class
);

$builder->add(
'email',
EmailType::class,
array(
'label' => 'Email'
)
EmailType::class
);

if(property_exists($entityName, 'phone')) {
if (property_exists($entityName, 'phone')) {
$builder->add(
'phone',
TextType::class,
array(
'label' => 'Téléphone'
)
TextType::class
);
}

$builder->add(
'submit',
SubmitType::class,
array(
'label' => 'Sauvegarder'
)
[
'label' => $this->translatorAdmin->transAction('save')
]
);
}


+ 0
- 3
Resources/assets/app/adminlte/field/collection/app.collection.js Voir le fichier

@@ -9,7 +9,6 @@ $(document).ready(function () {


function initCollectionWidget() {
Tools.log('czefe');

$('.field-collection[data-prototype]').each(function (i, collectionWidget) {
setCollectionWidgetSortable($(collectionWidget));
@@ -65,9 +64,7 @@ function getNumItems($collectionWidget) {
}

function reindexKeyCollectionWidget($collectionWidget) {
Tools.log('ncncnc');
if ($collectionWidget.data('reindex-key')) {
Tools.log('ncncnc');
$collectionWidget.find('.field-collection-item').each(function (i, item) {
$(item).find('input,textarea').each(function (y, field) {
let $field = $(field);

+ 2
- 0
Resources/assets/app/adminlte/field/filemanager/app.filemanager.js Voir le fichier

@@ -15,6 +15,7 @@ function initFileManager() {
let $field = $(this);
$('#' + $field.data('id')).val("");
$('#' + $field.data('id') + '_preview').prop('src',"");
$('#' + $field.data('id') + '_preview_text').html('Aucun fichier');
});
$('.lc-filemanager-open').off('click');
$('.lc-filemanager-open').on('click', function (e) {
@@ -25,6 +26,7 @@ function initFileManager() {
var path = $(this).attr('data-path')
$('#' + $field.data('id')).val(path);
$('#' + $field.data('id') + '_preview').prop('src',path);
$('#' + $field.data('id') + '_preview_text').html(path);
$('#lc-filemanager-modal').modal('hide');
});
});

+ 79
- 5
Resources/translations/admin.fr.yaml Voir le fichier

@@ -1,5 +1,79 @@
content_admin:
flash_message:
create: Le contenu "%name%" a été créé avec succès.
update: Le contenu "%name%" a été mis à jour avec succès.
delete: Le contenu "%name%" a été supprimé avec succès.

menu:
dashboard: Tableau de bord
page: Pages
user: Utilisateurs
user_index: Liste
account: Mon compte
account_profile: Informations personnelles
account_password: Mot de passe

title:
dashboard: Tableau de bord
index: '%label_plurial%'
sort: Ordonner "%label_plurial%"
new: Ajouter "%label%"
edit: Modifier "%label%" (#%id%)
detail: Voir "%label%" (#%id%)
account:
profile: Mes informations personnelles
change_password: Changer de mot de passe

action:
create: Créer
edit: Éditer
save: Sauvegarder
sort: Ordonner
delete: Supprimer
index_children: Afficher les enfants
index_parent: Retour au parent
back_index: Retour à la liste
save_and_return: Sauvegarder les modifications
save_and_continue: Sauvegarder et continuer l'édition
save_and_add_another: Créer et ajouter un nouvel élément

flash_message:
create: Le contenu "%name%" a été créé avec succès.
update: Le contenu "%name%" a été mis à jour avec succès.
delete: Le contenu "%name%" a été supprimé avec succès.
sort: Position modifiée

entity:
User:
label: Utilisateur
label_plurial: Utilisateurs
fields:
firstname: Prénom
lastname: Nom
Page:
label: Page
label_plurial: Pages
default:
fields:
title: Titre
position: Position
position_help: Position help
description: Description
description_help: Description help
file: Fichier
status: Statut
email: Email
metaTitle: Meta title
metaTitle_help: Affiché dans les résultats de recherche Google
metaDescription: Meta description
metaDescription_help: Affiché dans les résultats de recherche Google
oldUrls: Anciennes urls
devAlias: Alias
gallery: Galerie

panels:
general: Général
configuration: Configuration
gallery: Galerie
seo: Référencement

form:
change_password:
current_password: Mot de passe actuel
new_password: Nouveau mot de passe
new_password_repeat: Nouveau mot de passe (confirmer)

+ 2
- 1
Resources/views/adminlte/block/menu.html.twig Voir le fichier

@@ -1,5 +1,6 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{% macro render_menu_item(item, is_sub_item = false) %}

{% if item.isMenuSection %}
{% if item.icon is not empty %}
<i class="fa fa-{{ item.icon }}"></i>
@@ -11,7 +12,7 @@
{% if item.icon is not empty %}
<i class="far fa-{{ item.icon }} nav-icon"></i>
{% endif %}
<p>{{ item.label|raw }}</p>
<p>{{ item.label|lc_trans_admin_menu }}</p>
{% if item.hasSubItems %}<i class="right fas fa-angle-left"></i>{% endif %}
</a>
{% endif %}

+ 6
- 5
Resources/views/adminlte/crud/action/translatable.html.twig Voir le fichier

@@ -6,16 +6,17 @@
{% for _locale in app_locales %}
<a class="{{ isIncludedInDropdown|default(false) ? 'dropdown-item' }} {{ action.cssClass }}"
href="{{ action.linkUrl }}&_locale={{ _locale }}"
{% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
{%- if action.icon %}<i class="action-icon {{ action.icon }}"></i> {% endif -%}
{%- if action.label is not empty -%}{{ action.label }} {{ _locale }}{%- endif -%}
{% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
{%- if action.icon %}<i class="action-icon {{ action.icon }}"></i> {% endif -%}
{%- if action.label is not empty -%}{{ action.label }} {%- endif -%}
{{ _locale }}
</a>
{% endfor %}
{% elseif 'button' == action.htmlElement %}
<button class="{{ action.cssClass }}" {% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
<span class="btn-label">
<span class="btn-label">
{%- if action.icon %}<i class="action-icon {{ action.icon }}"></i> {% endif -%}
{%- if action.label is not empty -%}{{ action.label }}{%- endif -%}
{%- if action.label is not empty -%}{{ action.label }}{%- endif -%}
</span>
</button>
{% endif %}

+ 1
- 5
Resources/views/adminlte/crud/edit.html.twig Voir le fichier

@@ -7,11 +7,7 @@
{% block body_class 'ea-edit ea-edit-' ~ entity.name %}

{% block content_title %}
{%- apply spaceless -%}
{{ ea.crud.customPageTitle is null
? (ea.crud.defaultPageTitle|trans(ea.i18n.translationParameters, 'EasyAdminBundle'))|raw
: ea.crud.customPageTitle|trans(ea.i18n.translationParameters)|raw }}
{%- endapply -%}
{{ 'edit'|lc_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block delete_form %}

+ 132
- 35
Resources/views/adminlte/crud/form_theme.html.twig Voir le fichier

@@ -1,6 +1,89 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{% use '@EasyAdmin/crud/form_theme.html.twig' %}

{% block form_row %}
{% set row_attr = row_attr|merge({
class: row_attr.class|default('') ~ ' form-group'
}) %}

<div {% with { attr: row_attr } %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) -}}
<div class="form-widget">
{% set has_prepend_html = ea.field.prepend_html|default(null) is not null %}
{% set has_append_html = ea.field.append_html|default(null) is not null %}
{% set has_input_groups = has_prepend_html or has_append_html %}

{% if has_input_groups %}
<div class="input-group">{% endif %}
{% if has_prepend_html %}
<div class="input-group-prepend">
<span class="input-group-text">{{ ea.field.prepend_html|raw }}</span>
</div>
{% endif %}

{{ form_widget(form) }}

{% if has_append_html %}
<div class="input-group-append">
<span class="input-group-text">{{ ea.field.append_html|raw }}</span>
</div>
{% endif %}
{% if has_input_groups %}</div>{% endif %}

{% set nullable_fields_fqcn = [
'EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField',
'EasyCorp\Bundle\EasyAdminBundle\Field\DateField',
'EasyCorp\Bundle\EasyAdminBundle\Field\TimeField',
] %}
{% if form.vars.ea_crud_form.ea_field.fieldFqcn|default(false) in nullable_fields_fqcn and ea.field.nullable|default(false) %}
<div class="nullable-control">
<label>
<input type="checkbox" {% if data is null %}checked="checked"{% endif %}>
{{ 'label.nullable_field'|trans({}, 'EasyAdminBundle') }}
</label>
</div>
{% endif %}

{% set help_message = name|lc_trans_admin_help(form.parent.vars.data) %}
{% if help_message != '' %}
<small class="form-help">{{ help_message }}</small>
{% endif %}

{{- form_errors(form) -}}
</div>
</div>
{% endblock form_row %}

{% block form_label -%}
{% if label is same as(false) -%}
<label>{# the empty <label> is needed to not break the form design #}</label>
{%- else -%}
{%- if compound is defined and compound -%}
{%- set element = 'legend' -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%}
{%- else -%}
{%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%}
{%- endif -%}
{% if required -%}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
{%- endif -%}
{% if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{# {% set label = name|humanize %} #}
{%- endif -%}
{%- endif -%}

{# <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (translation_domain is same as(false)) ? label : label|lower|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</{{ element|default('label') }}> #}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|lc_trans_admin_field(form.parent.vars.data) }}</{{ element|default('label') }}>

{%- endif -%}
{%- endblock form_label %}

{% block gallery_manager_row %}
{{ block('collection_row') }}
{% endblock gallery_manager_row %}
@@ -9,7 +92,6 @@
{{ block('collection_widget') }}
{% endblock gallery_manager_widget %}


{% block collection_row %}
{% if prototype is defined and not prototype.rendered %}
{% set row_attr = row_attr|merge({ 'data-prototype': form_row(prototype) }) %}
@@ -65,49 +147,60 @@


{% block file_manager_widget %}
{% set managerDir = form.vars.ea_crud_form.ea_field.customOptions.get('managerDir') %}
{% set type = form.vars.ea_crud_form.ea_field.customOptions.get('type') %}

<div class="lc-filemanager row">
{% if type == 'image' %}
<div class="col-md-3 col-xs-12 form-group">
<div class="lc-filemenager-preview card">
<div class="no-image">
<i class="fa fa-image"></i>
</div>
<img src="{{ form.path.vars.value }}" id="{{ form.path.vars.id }}_preview" alt="" class="card-img-top">
<div class="lc-filemenager-preview card">
<div class="no-image">
<i class="fa fa-image"></i>
</div>
<img src="{{ form.path.vars.value }}" id="{{ form.path.vars.id }}_preview" alt="" class="card-img-top">
</div>
<div class="col-12">
<div class="input-group">
<div class="input-group-prepend">
{% if form.parent.vars['row_attr']['data-sortable'] is defined %}
<button type="button" class="btn btn-success lc-btn-sortable" data-toggle="tooltip"
title="Trier les images">
<i class="fa fa-arrows-alt"></i>
</button>
{% endif %}
<button type="button" class="btn btn-primary lc-filemanager-open" data-id="{{ form.path.vars.id }}"
data-toggle="tooltip" title="Sélectionner un fichier"
data-target="{{ path('file_manager', {module:1, conf:'default'})|raw }}">
<i class="fa fa-folder-open"></i>
</button>
</div>
{{ form_widget(form.legend) }}
<div class="input-group-append">
<button type="button" class="btn btn-danger lc-filemanager-delete" data-toggle="tooltip"
title="Supprimer l'image"
data-id="{{ form.path.vars.id }}">
<i class="fa fa-trash"></i>
</div>
{% else %}
<div class="callout callout-success">
<h5><i class="fa fa-file-alt"></i>
<span id="{{ form.path.vars.id }}_preview_text">{{ form.path.vars.value }}</span>
</h5>
</div>
{% endif %}

<div class="col-12">
<div class="input-group">
<div class="input-group-prepend">
{% if form.parent.vars['row_attr']['data-sortable'] is defined %}
<button type="button" class="btn btn-success lc-btn-sortable" data-toggle="tooltip"
title="Trier les images">
<i class="fa fa-arrows-alt"></i>
</button>
</div>
{% endif %}
<button type="button" class="btn btn-primary lc-filemanager-open" data-id="{{ form.path.vars.id }}"
data-toggle="tooltip" title="Sélectionner un fichier"
data-target="{{ path('file_manager', {module:1, conf: managerDir})|raw }}">
<i class="fa fa-folder-open"></i>
</button>
</div>
{{ form_widget(form.legend) }}
<div class="input-group-append">
<button type="button" class="btn btn-danger lc-filemanager-delete" data-toggle="tooltip"
title="Supprimer l'image"
data-id="{{ form.path.vars.id }}">
<i class="fa fa-trash"></i>
</button>
</div>


{{ form_rest(form) }}
</div>
{{ form_rest(form) }}
</div>
</div>
</div>
{% endblock file_manager_widget %}

{% block checkbox_radio_label -%}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{%- if widget is defined -%}
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class or 'switch-custom' in parent_label_class) %}
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class or 'switch-custom' in label_attr.class) %}
@@ -145,6 +238,7 @@
{{ name|lc_trad(easyadmin['entity']['name'], 'field') }}
{% else %} #}
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain))|raw -}}

{# {% endif %} #}
{{- form_errors(form) -}}
</label>
@@ -156,16 +250,18 @@
{{ parent() }}

{% if ea_crud_form.form_panels is defined %}

<div class="card card-outline">
<div class="card-header p-0 border-bottom-0">
<ul id="nav-params" class="nav nav-pills" role="navigation">
{% for panel_name, panel_config in ea_crud_form.form_panels|filter(panel_config => not panel_config.form_tab or panel_config.form_tab == tab_name) %}
{% set panel_has_header = panel_config.label|default(false) or panel_config.icon|default(false) %}
<li class="nav-item">
<a href="#panel-{{ panel_name }} " class="nav-link {{ panel_name == 1 ? 'active' }}" data-toggle="tab" role="tab"
<a href="#panel-{{ panel_name }} " class="nav-link {{ panel_name == 1 ? 'active' }}"
data-toggle="tab" role="tab"
aria-controls="panel-{{ panel_name }}">
{{ panel_config.label|raw }}
<i class="fa fa-exclamation-circle invalid-form"></i>
{{ panel_config.label|lc_trans_admin_panel(ea.getEntity().getFqcn()) }}
<i class="fa fa-exclamation-circle invalid-form"></i>
</a>
</li>
{% endfor %}
@@ -202,7 +298,8 @@
{% if panel_config.icon|default(false) %}
<i class="{{ panel_config.icon }}"></i>
{% endif %}
{{ panel_config.label|raw }}

{{ panel_config.label|lc_trans_admin_panel(ea.getEntity().getFqcn()) }}

{% if collapsible %}
</a>

+ 4
- 5
Resources/views/adminlte/crud/index.html.twig Voir le fichier

@@ -9,10 +9,7 @@
{% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}

{% block content_title %}
{%- apply spaceless -%}
{% set default_title = ea.crud.defaultPageTitle('index')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}
{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('index')|trans(ea.i18n.translationParameters)|raw }}
{%- endapply -%}
{{ 'index'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

{% block content_breadcrumb %}
@@ -25,6 +22,7 @@
{% endblock page_actions %}

{% block main %}

{# sort can be multiple; let's consider the sorting field the first one #}
{% set sort_field_name = app.request.get('sort')|keys|first %}
{% set sort_order = app.request.get('sort')|first %}
@@ -94,7 +92,7 @@
class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.label ? field.label|raw : field.getProperty|raw }}</span>
<span>{{ field.getProperty|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
</th>
{% endif %}
@@ -208,6 +206,7 @@
{{ parent() }}

<script type="text/javascript">

$(function () {

/* $('.action-delete').on('click', function (e) {

+ 1
- 6
Resources/views/adminlte/crud/new.html.twig Voir le fichier

@@ -7,14 +7,9 @@
{% block body_class 'ea-new ea-new-' ~ entity.name %}

{% block content_title %}
{%- apply spaceless -%}
{% set default_title = ea.crud.defaultPageTitle('new')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}
{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('new')|trans(ea.i18n.translationParameters)|raw }}
{%- endapply -%}
{{ 'new'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}



{% block body_javascript %}
{{ parent() }}


+ 1
- 2
Resources/views/adminlte/crud/sort.html.twig Voir le fichier

@@ -8,10 +8,9 @@
{% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}

{% block content_title %}
Édition position
{{ 'sort'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}


{% block content_breadcrumb %}
{{ include('@LcSov/adminlte/block/breadcrumb.html.twig') }}
{% endblock content_breadcrumb %}

+ 3
- 1
Resources/views/adminlte/dashboard.html.twig Voir le fichier

@@ -1,6 +1,8 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title 'SovBundle' %}
{% block content_title %}
{{ 'dashboard'|lc_trans_admin_title }}
{% endblock %}

{% block main %}
Tableau de bord par défaut.

+ 9
- 7
Resources/views/adminlte/layout.html.twig Voir le fichier

@@ -165,7 +165,7 @@
{% endfor %}

{% for webpack_encore_entry in ea.assets.webpackEncoreEntries ?? [] %}
{{ ea_call_function_if_exists('encore_entry_script_tags', webpack_encore_entry) }}
{{ ea_call_function_if_exists('encore_entry_script_tags', webpack_encore_entry, null, '_default', {'defer': false}) }}
{% endfor %}
{% endblock %}

@@ -182,13 +182,15 @@
{% if app.session is not null and app.session.started %}
{% set flash_messages = app.session.flashbag.all %}
{% if flash_messages|length > 0 %}
{% for label, messages in flash_messages %}
{% for message in messages %}
<script type="text/javascript">
Notification.add("{{ label }}", "{{ message|trans|raw|replace({'"': '\"'}) }}") ;
</script>
<script type="text/javascript">
$(document).ready(function() {
{% for label, messages in flash_messages %}
{% for message in messages %}
Notification.add("{{ label }}", "{{ message|trans|raw|replace({'"': '\"'}) }}");
{% endfor %}
{% endfor %}
{% endfor %}
});
</script>
{% endif %}
{% endif %}


+ 1
- 1
Resources/views/user/change_password.html.twig Voir le fichier

@@ -2,7 +2,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
Changer de mot de passe
{{ 'account.change_password'|lc_trans_admin_title }}
{% endblock %}

{% block main %}

+ 1
- 1
Resources/views/user/profile.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
Mes informations personnelles
{{ 'account.profile'|lc_trans_admin_title }}
{% endblock %}

{% block main %}

+ 145
- 0
Translation/TranslatorAdmin.php Voir le fichier

@@ -0,0 +1,145 @@
<?php

namespace Lc\SovBundle\Translation;

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Symfony\Contracts\Translation\TranslatorInterface;

class TranslatorAdmin
{
protected $translator;

const DOMAIN = 'admin';

public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}

public function transAction($action)
{
return $this->trans('action.' . $action);
}

public function transMenu($menu)
{
return $this->trans('menu.' . $menu);
}

public function transFlashMessage($name)
{
return $this->trans('flash_message.' . $name);
}

public function transField($fieldName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true)
);
}

public function transHelp($fieldName, $entityClass): string
{
$fieldName = $fieldName . '_help';

return $this->transEntityThenDefault(
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true),
true
);
}

public function transPanel($panelName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdPanel($panelName, $entityClass),
$this->buildTransIdPanel($panelName, $entityClass, true)
);
}

public function transTitle($pageName, $entityClass = null, $params = [])
{
$entityName = $this->getEntityName($entityClass);

$paramsTranslation = [];

if ($entityName) {
$baseIdEntityLabel = 'entity.' . $entityName;
$paramsTranslation = [
'%label%' => $this->trans($baseIdEntityLabel . '.label'),
'%label_plurial%' => $this->trans($baseIdEntityLabel . '.label_plurial'),
];
}

if (isset($params['id'])) {
$paramsTranslation['%id%'] = $params['id'];
}

return $this->trans(
'title.' . $pageName,
$paramsTranslation
);
}

private function transEntityThenDefault($idTranslationEntity, $idTranslationDefault, $returnEmpty = false): string
{
$translation = $this->trans($idTranslationEntity);

if ($translation == $idTranslationEntity) {
$translation = $this->trans($idTranslationDefault);

if ($translation == $idTranslationDefault) {
if ($returnEmpty) {
$translation = '';
} else {
$translation = $idTranslationEntity;
}
}
}

return $translation;
}

private function buildTransIdField($fieldName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($fieldName, $entityClass, 'fields', $default);
}

private function buildTransIdPanel($panelName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default);
}

private function buildTransIdEntitySection($name, $entityClass, $entitySection, $default): string
{
if ($default) {
$entityName = 'default';
} else {
$entityName = $this->getEntityName($entityClass);
}

return 'entity.' . $entityName . '.' . $entitySection . '.' . $name;
}

private function trans($id, $params = [], $domain = self::DOMAIN): string
{
return $this->translator->trans($id, $params, $domain);
}

private function getEntityName($entityClass): string
{
if (is_object($entityClass)) {
$entityClass = get_class($entityClass);
}

if (is_string($entityClass)) {
$entityNameExplode = explode('\\', $entityClass);
return $entityNameExplode[count($entityNameExplode) - 1];
}

return 'default';
}
}

?>

+ 129
- 75
Twig/TwigExtension.php Voir le fichier

@@ -3,105 +3,159 @@
namespace Lc\SovBundle\Twig;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class TwigExtension extends AbstractExtension
{
protected $em;
protected $kernel;
protected $parameterBag;
protected $cacheManager;
protected $requestStack;
protected $router;

public function __construct(KernelInterface $kernel, ParameterBagInterface $parameterBag, CacheManager $cacheManager, EntityManagerInterface $entityManager, RequestStack $requestStack,UrlGeneratorInterface $router)
{
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
$this->cacheManager = $cacheManager;
$this->em = $entityManager;
$this->requestStack = $requestStack;
$this->router = $router;
protected $em;
protected $kernel;
protected $parameterBag;
protected $cacheManager;
protected $requestStack;
protected $router;
protected $translator;
protected $translatorAdmin;

public function __construct(
KernelInterface $kernel,
ParameterBagInterface $parameterBag,
CacheManager $cacheManager,
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin
) {
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
$this->cacheManager = $cacheManager;
$this->em = $entityManager;
$this->requestStack = $requestStack;
$this->router = $router;
$this->translator = $translator;
$this->translatorAdmin = $translatorAdmin;
}

public function getFunctions()
{
return array(
new TwigFunction('lc_liip', [$this, 'lcLiip']),
new TwigFunction('homepage_route', [$this, 'homepageRoute']),
new TwigFunction('page_by_dev_alias', [$this, 'getPageByDevAlias']),
new TwigFunction('translated_urls', [$this, 'getTranslatedUrls'])
);
}


public function getFilters()
{
return [
new TwigFilter('lc_cache', [$this, 'lcCache']),
new TwigFilter('lc_trans_admin_field', [$this, 'lcTransAdminField']),
new TwigFilter('lc_trans_admin_help', [$this, 'lcTransAdminHelp']),
new TwigFilter('lc_trans_admin_panel', [$this, 'lcTransAdminPanel']),
new TwigFilter('lc_trans_admin_menu', [$this, 'lcTransAdminMenu']),
new TwigFilter('lc_trans_admin_title', [$this, 'lcTransAdminTitle']),
new TwigFilter('lc_trans_admin_action', [$this, 'lcTransAdminAction']),
];
}

public function lcCache($file)
{
$cacheTime = filemtime($this->kernel->getProjectDir() . '/public' . $file);
if ($cacheTime) {
return $file . '?c=' . $cacheTime;
} else {
return $file . "?c=0";
}

public function getFunctions()
{
return array(
new TwigFunction('lc_liip', [$this, 'lcLiip']),
new TwigFunction('homepage_route', [$this, 'homepageRoute']),
new TwigFunction('page_by_dev_alias', [$this, 'getPageByDevAlias']),
new TwigFunction('translated_urls', [$this, 'getTranslatedUrls'])
);
}

public function lcTransAdminField($fieldName, $entityClass)
{
return $this->translatorAdmin->transField($fieldName, $entityClass) ;
}

public function lcTransAdminHelp($fieldName, $entityClass)
{
return $this->translatorAdmin->transHelp($fieldName, $entityClass) ;
}

public function lcTransAdminPanel($panelName, $entityClass)
{
return $this->translatorAdmin->transPanel($panelName, $entityClass) ;
}

public function lcTransAdminMenu($menuName)
{
return $this->translatorAdmin->transMenu($menuName);;
}

public function lcTransAdminAction($actionName)
{
return $this->translatorAdmin->transAction($actionName);;
}

public function lcTransAdminTitle($pageName, $entityClass = null, $params = [])
{
return $this->translatorAdmin->transTitle($pageName, $entityClass, $params) ;
}

public function lcLiip($path, $thumb = 'tile', $default = 'default.jpg')
{
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}

if ($path) {
$fileManagerFolder = substr($this->getFileManagerFolder(), 1);

public function getFilters()
{
return [
new TwigFilter('lc_cache', [$this, 'lcCache']),
];
}
if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder . '/' . $path;
}

public function lcCache($file)
{
$cacheTime = filemtime($this->kernel->getProjectDir() . '/public' . $file);
if ($cacheTime) {
return $file . '?c=' . $cacheTime;
} else {
return $file . "?c=0";
}
if (file_exists($path)) {
return $this->cacheManager->getBrowserPath($path, $thumb);
}
}

public function lcLiip($path, $thumb = 'tile', $default = 'default.jpg')
{
if (substr($path, 0, 1) === '/') $path = substr($path, 1);

if ($path) {
$fileManagerFolder = substr($this->getFileManagerFolder(), 1) ;
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
}

if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder . '/' . $path;
}
function getTranslatedUrls()
{
$ret = array();
$langs = $this->parameterBag->get('app.locales');
$currentRoute = $this->requestStack->getCurrentRequest()->get('_route');

if (file_exists($path)) {
return $this->cacheManager->getBrowserPath($path, $thumb);
}
}
$params = array_merge((array)$this->requestStack->getCurrentRequest()->get('_route_params'), $_GET);

return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
if ($currentRoute) {
foreach ($langs as $lg) {
$ret[$lg] = $this->router->generate($currentRoute, array_merge($params, array('_locale' => $lg)));
}
}

function getTranslatedUrls()
{
$ret = array();
$langs = $this->parameterBag->get('app.locales');
$currentRoute = $this->requestStack->getCurrentRequest()->get('_route');
return $ret;
}

$params = array_merge((array)$this->requestStack->getCurrentRequest()->get('_route_params'), $_GET);
public function getFileManagerFolder()
{
return $this->parameterBag->get('app.path_uploads');
}

if ($currentRoute) {
foreach($langs as $lg) {
$ret[$lg] = $this->router->generate($currentRoute, array_merge($params, array('_locale'=>$lg)));
}
}

return $ret;
}

public function getFileManagerFolder()
{
return $this->parameterBag->get('app.path_uploads');
}

public function homepageRoute(){
return $this->parameterBag->get('lc_sov.homepage_route');
}
public function homepageRoute()
{
return $this->parameterBag->get('lc_sov.homepage_route');
}

}

Chargement…
Annuler
Enregistrer