Release 2.0.19 (#4022)

* prevent invoices with exceeding filename
* fixed invalid LDAP log level
* support locale switching in action events
This commit is contained in:
Kevin Papst
2023-05-12 14:45:51 +02:00
committed by GitHub
parent 1099e76244
commit 4b2a3669e6
12 changed files with 77 additions and 61 deletions

View File

@@ -19,6 +19,8 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
*/
abstract class AbstractActionsSubscriber implements EventSubscriberInterface
{
private ?string $locale = null;
public function __construct(private AuthorizationCheckerInterface $auth, private UrlGeneratorInterface $urlGenerator)
{
}
@@ -30,16 +32,27 @@ abstract class AbstractActionsSubscriber implements EventSubscriberInterface
protected function path(string $route, array $parameters = []): string
{
if ($this->locale !== null) {
$parameters['_locale'] = $this->locale;
}
return $this->urlGenerator->generate($route, $parameters);
}
public static function getSubscribedEvents(): array
{
return [
'actions.' . static::getActionName() => ['onActions', 1000],
'actions.' . static::getActionName() => ['handleEvent', 1000],
];
}
final public function handleEvent(PageActionsEvent $event): void
{
$this->locale = $event->getLocale();
$this->onActions($event);
}
public static function getActionName(): string
{
throw new \Exception('You need to overwrite getActionName() or getSubscribedEvents() in ' . static::class);