Skip to content

Commit

Permalink
report translation domain fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alterphp committed Dec 3, 2018
1 parent 2257f5e commit dbf0c1c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Configuration/ListFormFiltersConfigPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ private function processObjectListFormFilters(string $objectType, array &$object
}

if ('entity' === $objectType) {
$this->configureEntityFormFilter($objectConfig['class'], $filterConfig);
$this->configureEntityFormFilter(
$objectConfig['class'],
$filterConfig,
isset($backendConfig['translation_domain']) ? $backendConfig['translation_domain'] : 'EasyAdminBundle'
);
}

// If type is not configured at this steps => not guessable
Expand All @@ -98,7 +102,7 @@ private function processObjectListFormFilters(string $objectType, array &$object
}
}

private function configureEntityFormFilter(string $entityClass, array &$filterConfig)
private function configureEntityFormFilter(string $entityClass, array &$filterConfig, string $translationDomain)
{
// No need to guess type
if (isset($filterConfig['type'])) {
Expand All @@ -118,7 +122,7 @@ private function configureEntityFormFilter(string $entityClass, array &$filterCo

if ($entityMetadata->hasField($filterConfig['property'])) {
$this->configureEntityPropertyFilter(
$entityClass, $entityMetadata->getFieldMapping($filterConfig['property']), $filterConfig
$entityClass, $entityMetadata->getFieldMapping($filterConfig['property']), $filterConfig, $translationDomain
);
} elseif ($entityMetadata->hasAssociation($filterConfig['property'])) {
$this->configureEntityAssociationFilter(
Expand All @@ -127,7 +131,7 @@ private function configureEntityFormFilter(string $entityClass, array &$filterCo
}
}

private function configureEntityPropertyFilter(string $entityClass, array $fieldMapping, array &$filterConfig)
private function configureEntityPropertyFilter(string $entityClass, array $fieldMapping, array &$filterConfig, string $translationDomain)
{
switch ($fieldMapping['type']) {
case 'boolean':
Expand All @@ -137,7 +141,7 @@ private function configureEntityPropertyFilter(string $entityClass, array $field
'list_form_filters.default.boolean.true' => true,
'list_form_filters.default.boolean.false' => false,
),
'choice_translation_domain' => 'EasyAdminBundle',
'choice_translation_domain' => $translationDomain,
);
break;
case 'string':
Expand All @@ -146,6 +150,7 @@ private function configureEntityPropertyFilter(string $entityClass, array $field
'multiple' => true,
'choices' => $this->getChoiceList($entityClass, $filterConfig['property'], $filterConfig),
'attr' => array('data-widget' => 'select2'),
'choice_translation_domain' => $translationDomain,
);
break;
default:
Expand Down

0 comments on commit dbf0c1c

Please sign in to comment.