Pārlūkot izejas kodu

Correftif filtre

feature/symfony6.1
Fabien Normand pirms 3 gadiem
vecāks
revīzija
54db32854f
13 mainītis faili ar 334 papildinājumiem un 84 dzēšanām
  1. +1
    -1
      Builder/Ticket/TicketBuilder.php
  2. +1
    -1
      Builder/Ticket/TicketMessageBuilder.php
  3. +2
    -0
      Controller/AbstractAdminController.php
  4. +41
    -38
      Field/Filter/FilterManager.php
  5. +1
    -2
      Form/Common/CrudFormType.php
  6. +41
    -38
      Form/Common/FiltersFormType.php
  7. +119
    -0
      Notification/MailMailjetNotification.php
  8. +101
    -0
      Notification/SmsFactorNotification.php
  9. +1
    -1
      Resources/views/adminlte/crud/detail.html.twig
  10. +1
    -1
      Resources/views/adminlte/embed/card.html.twig
  11. +1
    -1
      Resources/views/adminlte/embed/infobox.html.twig
  12. +13
    -0
      Translation/TranslatorAdmin.php
  13. +11
    -1
      Twig/TranslatorTwigExtension.php

+ 1
- 1
Builder/Ticket/TicketBuilder.php Parādīt failu

@@ -3,7 +3,7 @@
namespace Lc\SovBundle\Builder\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Notification\MailMailjetNotification;
use Lc\SovBundle\Notification\MailMailjetNotification;
use Lc\SovBundle\Component\FormComponent;
use Lc\SovBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Model\Ticket\TicketInterface;

+ 1
- 1
Builder/Ticket/TicketMessageBuilder.php Parādīt failu

@@ -3,7 +3,7 @@
namespace Lc\SovBundle\Builder\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Notification\MailMailjetNotification;
use Lc\SovBundle\Notification\MailMailjetNotification;
use Lc\SovBundle\Component\FormComponent;
use Lc\SovBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Factory\Ticket\TicketMessageFactory;

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

@@ -59,6 +59,7 @@ use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\Filter\FilterManager;
use Lc\SovBundle\Form\Common\FiltersFormType;
use Lc\SovBundle\Form\Common\PositionType;
use Lc\SovBundle\Notification\MailMailjetNotification;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
@@ -99,6 +100,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController
GroupUserContainer::class => GroupUserContainer::class,
UserContainer::class => UserContainer::class,
SiteSettingContainer::class => SiteSettingContainer::class,
MailMailjetNotification::class => MailMailjetNotification::class,
]
);
}

+ 41
- 38
Field/Filter/FilterManager.php Parādīt failu

@@ -14,6 +14,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -38,7 +39,9 @@ class FilterManager

public function handleFiltersForm(QueryBuilder $queryBuilder, Form $filtersForm, $fields, EntityDto $entityDto)
{

foreach ($fields as $field) {
$filteredValue = array();
if ($field instanceof FieldInterface) {
$fieldDto = $field->getAsDto();
} else {
@@ -47,27 +50,24 @@ class FilterManager
if ($fieldDto->isDisplayedOn(Crud::PAGE_INDEX)) {
if ($filtersForm->has($this->getFieldPropertySnake($fieldDto->getProperty()))) {



if ($fieldDto->getFormType() === DateTimeType::class || $fieldDto->getFormType(
) === DateType::class) {
if ($fieldDto->getFormType() === DateTimeType::class || $fieldDto->getFormType() === DateType::class) {
$filteredValue['dateStart'] = $this->getFilteredValue(
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty(),
'dateStart'
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty(),
'dateStart'
);
$filteredValue['dateEnd'] = $this->getFilteredValue(
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty(),
'dateEnd'
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty(),
'dateEnd'
);
}else{
$filteredValue = $this->getFilteredValue(
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty()
} else {
$filteredValue['value'] = $this->getFilteredValue(
$filtersForm,
$entityDto->getFqcn(),
$fieldDto->getProperty()
);
}
$this->applyFilter($queryBuilder, $fieldDto, $filteredValue);
@@ -76,50 +76,52 @@ class FilterManager
}
}

public function applyFilter(QueryBuilder $queryBuilder, FieldDto $fieldDto, $filteredValue)
public function applyFilter(QueryBuilder $queryBuilder, FieldDto $fieldDto, array $filteredValue)
{
switch ($fieldDto->getFormType()) {
case CheckboxType::class:
$checkboxFilter = new CheckboxFilter();
$checkboxFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue);
$checkboxFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']);
break;
case ChoiceType::class:
$choiceFilter = new ChoiceFilter();
$choiceFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue);
$choiceFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']);
break;
case IntegerType::class:
$integerFilter = new IntegerFilter();
$integerFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue);
$integerFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']);
break;
case TextareaType::class:
case TextType::class:
$textFilter = new TextFilter();
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue);
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']);
break;
case EntityType::class:
$textFilter = new AssociationFilter();
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue);
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']);
break;
case DateTimeType::class:
case DateType::class:
$textFilter = new DateFilter();
$textFilter->applyFilter(
$queryBuilder,
$fieldDto->getProperty(),
$filteredValue['dateStart'],
$filteredValue['dateEnd']
$queryBuilder,
$fieldDto->getProperty(),
$filteredValue['dateStart'],
$filteredValue['dateEnd']
);
break;
}
}

public function getFilteredValue(
Form $filtersForm,
string $entityFqcn,
string $field,
string $dateExtraField = null
) {
Form $filtersForm,
string $entityFqcn,
string $field,
string $dateExtraField = null
)
{
$field = $this->getFieldPropertySnake($field);
$sessionParam = $entityFqcn.$field.$dateExtraField;
$sessionParam = $entityFqcn . $field . $dateExtraField;

$formField = $this->getFormField($filtersForm, $field, $dateExtraField);

@@ -147,7 +149,7 @@ class FilterManager
//Champ association
} elseif ($formField->getConfig()->getOption('class')) {
$valFormated = $this->em->getRepository(
$formField->getConfig()->getOption('class')
$formField->getConfig()->getOption('class')
)->find($value);
$filtersForm->get($field)->setData($valFormated);
} else {
@@ -162,10 +164,11 @@ class FilterManager

public
function getFormField(
Form $filtersForm,
string $field,
string $extraField = null
): Form {
Form $filtersForm,
string $field,
string $extraField = null
): Form
{
if ($extraField) {
return $filtersForm->get($field)->get($extraField);
} else {

+ 1
- 2
Form/Common/CrudFormType.php Parādīt failu

@@ -40,8 +40,7 @@ class CrudFormType extends AbstractType
$formPanels = [];
$currentFormPanel = 0;
foreach ($entityDto->getFields() as $fieldDto) {
dump($fieldDto);
dump( $fieldDto->getFormType());

if (null === $formFieldType = $fieldDto->getFormType()) {
$guessType = $this->doctrineOrmTypeGuesser->guessType($entityDto->getFqcn(), $fieldDto->getProperty());
$formFieldType = $guessType->getType();

+ 41
- 38
Form/Common/FiltersFormType.php Parādīt failu

@@ -25,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -52,6 +53,7 @@ class FiltersFormType extends AbstractType
$fieldDto = $field;
}
if ($fieldDto->isDisplayedOn(Crud::PAGE_INDEX)) {
dump($fieldDto);
switch ($fieldDto->getFormType()) {
case CheckboxType::class:
$checkboxFilter = new CheckboxFilter();
@@ -68,6 +70,7 @@ class FiltersFormType extends AbstractType

break;
case TextType::class:
case TextareaType::class:
$textFilter = new TextFilter();
$textFilter->buildProperty($builder, $fieldDto);
break;
@@ -77,8 +80,8 @@ class FiltersFormType extends AbstractType
$textFilter->buildProperty($builder, $fieldDto);
break;
case EntityType::class:
// $associationFilter = new AssociationFilter();
// $associationFilter->buildProperty($builder, $fieldDto, $options);
//$associationFilter = new AssociationFilter();
//$associationFilter->buildProperty($builder, $fieldDto, $options);
break;
case 'dateinterval':

@@ -90,34 +93,34 @@ class FiltersFormType extends AbstractType
}
}
$builder->add(
'action_apply',
SubmitType::class,
array(
'label_html'=> true,
'label'=> '<i class="fa fa-search"></i>',
'attr' => array(
'class' => 'btn btn-sm btn-info',
'form' => 'filters-form',
'data-toggle'=>"tooltip",
'title'=> $this->translatorAdmin->transAction("apply"),
'aria-label'=> $this->translatorAdmin->transAction("apply")
),
)
'action_apply',
SubmitType::class,
array(
'label_html' => true,
'label' => '<i class="fa fa-search"></i>',
'attr' => array(
'class' => 'btn btn-sm btn-info',
'form' => 'filters-form',
'data-toggle' => "tooltip",
'title' => $this->translatorAdmin->transAction("apply"),
'aria-label' => $this->translatorAdmin->transAction("apply")
),
)
);
$builder->add(
'action_reset',
ButtonType::class,
array(
'label_html'=> true,
'label'=> '<i class="fa fa-eraser"></i>',
'attr' => array(
'class' => 'btn btn-sm btn-warning lc-reset-filters',
'form' => 'filters-form',
'data-toggle'=>"tooltip",
'title'=> $this->translatorAdmin->transAction("reset"),
'aria-label'=> $this->translatorAdmin->transAction("reset")
),
)
'action_reset',
SubmitType::class,
array(
'label_html' => true,
'label' => '<i class="fa fa-eraser"></i>',
'attr' => array(
'class' => 'btn btn-sm btn-warning lc-reset-filters',
'form' => 'filters-form',
'data-toggle' => "tooltip",
'title' => $this->translatorAdmin->transAction("reset"),
'aria-label' => $this->translatorAdmin->transAction("reset")
),
)
);
$builder->add('reset', HiddenType::class);
}
@@ -125,16 +128,16 @@ class FiltersFormType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'label' => false,
'csrf_protection' => false,
'entity_dto' => null,
//'translation_domain' => 'lcshop',
'fields' => false,
'entity_name' => false,
'entity_class' => false,
//'entityClass' => false
]
[
'label' => false,
'csrf_protection' => false,
'entity_dto' => null,
//'translation_domain' => 'lcshop',
'fields' => false,
'entity_name' => false,
'entity_class' => false,
//'entityClass' => false
]
);
}
}

+ 119
- 0
Notification/MailMailjetNotification.php Parādīt failu

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

namespace Lc\SovBundle\Notification;

use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Twig\Environment;

class MailMailjetNotification
{
const SUBJECT = 'subject';
const SUBJECT_PREFIX = 'subject-prefix';
const TO_EMAIL = 'to-email';
const COPY_TO = 'copy-to';
const COPY_HIDDEN_TO = 'copy-hidden-to';
const TO_NAME = 'to-name';
const FROM_EMAIL = 'from-email';
const FROM_NAME = 'from-name';
const REPLY_TO = 'reply-to';
const CONTENT_TEMPLATE = 'content-template';
const CONTENT_DATA = 'content-data';
const ATTACHMENT_DATA = 'attachment-data';
const ATTACHMENT_FILENAME = 'attachment-filename';
const ATTACHMENT_CONTENT_TYPE = 'attachment-content-type';
//const DISPOSITION_NOTIFICATION_TO = 'disposition-notification-to' ;

protected MailjetTransport $transport;
protected Environment $templating;
protected ParameterBagInterface $parameterBag;
protected MerchantResolver $merchantResolver;
protected SettingSolver $settingSolver;

public function __construct(
MailjetTransport $mailjetTransport,
Environment $templating,
ParameterBagInterface $parameterBag,
MerchantResolver $merchantResolver,
SettingSolver $settingSolver
)
{
$this->transport = $mailjetTransport;
$this->templating = $templating;
$this->parameterBag = $parameterBag;
$this->merchantResolver = $merchantResolver;
$this->settingSolver = $settingSolver;
}

public function send($params = [])
{
$merchantCurrent = $this->merchantResolver->getCurrent();

$merchantConfigEmailFrom = $this->settingSolver->getSettingValue($merchantCurrent, MerchantSettingDefinition::SETTING_EMAIL_FROM);
$emailFrom = (isset($params[self::FROM_EMAIL]) && $params[self::FROM_EMAIL] && strlen($params[self::FROM_EMAIL])) ? $params[self::FROM_EMAIL] : $merchantConfigEmailFrom;

$merchantConfigEmailFromName = $this->settingSolver->getSettingValue($merchantCurrent, MerchantSettingDefinition::SETTING_EMAIL_FROM_NAME);
$emailFromName = isset($params[self::FROM_NAME]) ?? $merchantConfigEmailFromName;

$merchantConfigEmailSubjectPrefix = $this->settingSolver->getSettingValue($merchantCurrent, MerchantSettingDefinition::SETTING_EMAIL_SUBJECT_PREFIX);
$emailSubjectPrefix = isset($params[self::SUBJECT_PREFIX]) ?? $merchantConfigEmailSubjectPrefix;
if ($emailSubjectPrefix && strlen($emailSubjectPrefix)) {
$emailSubjectPrefix .= ' ';
}

$message = new \Swift_Message($emailSubjectPrefix . $params[self::SUBJECT]);


if ($this->parameterBag->get('mailjet.dev.redirect.active') == 1) {
$message->addTo($this->parameterBag->get('mailjet.dev.redirect.email'),
isset($params[self::TO_NAME]) ?? null);
} else {
$message->addTo(
$params[self::TO_EMAIL],
isset($params[self::TO_NAME]) ?? null);
}

$contentData = [];
if (isset($params[self::CONTENT_DATA])) {
$contentData = $params[self::CONTENT_DATA];
}
dump($emailFrom);
$message->addFrom($emailFrom, $emailFromName)
->setBody($this->templating->render($params[self::CONTENT_TEMPLATE] . '-html.html.twig', $contentData), 'text/html')
->addPart($this->templating->render($params[self::CONTENT_TEMPLATE] . '-text.html.twig', $contentData));

if (isset($params[self::COPY_TO]) && strlen($params[self::COPY_TO])) {
$message->addCc($params[self::COPY_TO]);
}

if (isset($params[self::COPY_HIDDEN_TO]) && strlen($params[self::COPY_HIDDEN_TO])) {
$message->addBcc($params[self::COPY_HIDDEN_TO]);
}

if (isset($params[self::REPLY_TO]) && strlen($params[self::REPLY_TO])) {
$message->addReplyTo($params[self::REPLY_TO]);
}

if (isset($params[self::ATTACHMENT_DATA]) && isset($params[self::ATTACHMENT_FILENAME]) && isset($params[self::ATTACHMENT_CONTENT_TYPE])) {
$message->attach(\Swift_Attachment::newInstance(
$params[self::ATTACHMENT_DATA],
$params[self::ATTACHMENT_FILENAME],
$params[self::ATTACHMENT_CONTENT_TYPE]
));
}

/*if(isset($params[self::DISPOSITION_NOTIFICATION_TO]) && $params[self::DISPOSITION_NOTIFICATION_TO]) {
$emailFromDispositionNotificationTo = $emailFrom ;
if(isset($params[self::REPLY_TO]) && strlen($params[self::REPLY_TO])) {
$emailFromDispositionNotificationTo = $params[self::REPLY_TO] ;
}
$message->getHeaders()->addTextHeader('Disposition-Notification-To', $emailFromDispositionNotificationTo) ;
$message->getHeaders()->addMailboxHeader('Disposition-Notification-To', $emailFromDispositionNotificationTo);
}*/

return $this->transport->send($message);
}
}

+ 101
- 0
Notification/SmsFactorNotification.php Parādīt failu

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

namespace Lc\SovBundle\Notification;

use Lc\SovBundle\Component\StringComponent;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Twig\Environment;

class SmsFactorNotification
{
const TO_USER = 'to-user';
const CONTENT_MESSAGE = 'content-message';
const CONTENT_TEMPLATE = 'content-template';
const CONTENT_DATA = 'content-data';

protected HttpClientInterface $client;
protected ParameterBagInterface $parameterBag;
protected MailMailjetNotification $mailMailjetNotification;
protected StringComponent $stringComponent;
protected Environment $templating;

public function __construct(
HttpClientInterface $client,
ParameterBagInterface $parameterBag,
MailMailjetNotification $mailMailjetNotification,
StringComponent $stringComponent,
Environment $templating
)
{
$this->client = $client;
$this->parameterBag = $parameterBag;
$this->mailMailjetNotification = $mailMailjetNotification;
$this->stringComponent = $stringComponent;
$this->templating = $templating;
}

public function send($params = [])
{
$user = isset($params[self::TO_USER]) ? $params[self::TO_USER] : null;

if ($user) {
$phone = $this->stringComponent->formatPhoneNumber($user->getPhone());

$message = '';
if (isset($params[self::CONTENT_MESSAGE])) {
$message = $params[self::CONTENT_MESSAGE];
} elseif (isset($params[self::CONTENT_TEMPLATE])) {
$template = $params[self::CONTENT_TEMPLATE];
$paramsTemplate = [];
if (isset($params[self::CONTENT_DATA]) && is_array($params[self::CONTENT_DATA])) {
$paramsTemplate = $params[self::CONTENT_DATA];
}
$message = $this->templating->render($template, $paramsTemplate);
}

if ($this->parameterBag->get('mailjet.dev.redirect.active') == 1) {
$this->mailMailjetNotification->send([
MailMailjetNotification::SUBJECT => 'Notification par SMS à ' . $phone,
MailMailjetNotification::TO_EMAIL => $user->getEmail(),
MailMailjetNotification::CONTENT_TEMPLATE => 'mail/notification',
MailMailjetNotification::CONTENT_DATA => [
'message' => $message
],
]);

return true;
} else {
$token = $this->parameterBag->get('smsfactor.token');
$from = $this->parameterBag->get('smsfactor.from');

if ($token && strlen($token) > 0) {

$response = $this->client->request(
'GET',
'https://api.smsfactor.com/send',
[
'headers' => [
'Authorization' => 'Bearer ' . $token,
'Content-Type' => 'application/json; charset=utf-8',
'Accept' => 'application/json'
],
'query' => [
'sender' => $from,
'to' => $phone,
'text' => $message,
],
]
);

return $response;
} else {
throw new \ErrorException('Le token SMS SmsFactor n\'est pas défini.');
}
}
}

return false;
}

}

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

@@ -6,7 +6,7 @@
{% trans_default_domain ea.i18n.translationDomain %}

{% block content_title %}
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block content_breadcrumb %}

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

@@ -1,4 +1,4 @@
<div class="card {% block class %}{% endblock %}" id="{% block id %}{% endblock %}">
<div class="card {% block class %}{% endblock %}" id="{% block id %}{% endblock %}" {% block attr %}{% endblock %}>
{% block header_wrapper %}
<div class="card-header {% block header_class %}{% endblock %}">
{% block header %}

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

@@ -4,7 +4,7 @@
<div class="info-box-content">
<span class="info-box-text">{% block title %}{% endblock %}</span>
<span class="info-box-number">{% block content %}{% endblock %}</span>
<div class="float-right">
<div class="text-right">
{% block button %}{% endblock %}
</div>
</div>

+ 13
- 0
Translation/TranslatorAdmin.php Parādīt failu

@@ -73,6 +73,14 @@ class TranslatorAdmin
);
}

public function transModal($modalName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdModal($modalName, $entityClass),
$this->buildTransIdModal($modalName, $entityClass, true)
);
}

public function transCard($cardName, $entityClass): string
{
return $this->transEntityThenDefault(
@@ -141,6 +149,11 @@ class TranslatorAdmin
return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default);
}

private function buildTransIdModal($modalName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($modalName, $entityClass, 'modals', $default);
}

private function buildTransIdCard($cardName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($cardName, $entityClass, 'cards', $default);

+ 11
- 1
Twig/TranslatorTwigExtension.php Parādīt failu

@@ -44,11 +44,13 @@ class TranslatorTwigExtension extends AbstractExtension
new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']),
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']),
new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']),
new TwigFilter('sov_trans_admin_modal', [$this, 'transAdminModal']),
new TwigFilter('sov_trans_admin_card', [$this, 'transAdminCard']),
new TwigFilter('sov_trans_admin_box', [$this, 'transAdminBox']),
new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']),
new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']),
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']),
new TwigFilter('sov_trans_admin_choice', [$this, 'transAdminChoice']),
];
}

@@ -74,6 +76,11 @@ class TranslatorTwigExtension extends AbstractExtension
return $this->translatorAdmin->transField($fieldName, $entityClass);
}

public function transAdminChoice($choice, $fieldName, $entityClass)
{
return $this->translatorAdmin->transChoice($entityClass, $fieldName, $choice);
}

public function transAdminHelp($fieldName, $entityClass)
{
return $this->translatorAdmin->transHelp($fieldName, $entityClass);
@@ -83,7 +90,10 @@ class TranslatorTwigExtension extends AbstractExtension
{
return $this->translatorAdmin->transPanel($panelName, $entityClass);
}

public function transAdminModal($modalName, $entityClass)
{
return $this->translatorAdmin->transModal($modalName, $entityClass);
}

public function transAdminBox($boxName, $entityClass= 'default')
{

Notiek ielāde…
Atcelt
Saglabāt