ACP EmergencyFilter: Do not loop on choices to show the picked one

This commit is contained in:
Julien Fastré 2022-10-06 22:42:35 +02:00
parent a324121f01
commit 02330fcc75

View File

@ -73,15 +73,11 @@ class EmergencyFilter implements FilterInterface
public function describeAction($data, $format = 'string'): array
{
foreach (self::CHOICES as $k => $v) {
if ($v === $data['accepted_emergency']) {
$choice = $k;
}
}
return [
'Filtered by emergency: only %emergency%', [
'%emergency%' => $this->translator->trans($choice),
'%emergency%' => $this->translator->trans(
$data['accepted_emergency'] ? 'is emergency' : 'is not emergency'
),
],
];
}