mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +08:00
Merge event listener registration
This commit is contained in:
parent
79b00cb94f
commit
520e1550d1
|
@ -43,13 +43,13 @@ class Formatter implements ExtenderInterface
|
|||
|
||||
// Also set up an event listener to flush the formatter cache whenever
|
||||
// this extension is enabled or disabled.
|
||||
$flush = function ($event) use ($container, $extension) {
|
||||
if ($event->extension === $extension) {
|
||||
$container->make(ActualFormatter::class)->flush();
|
||||
$events->listen(
|
||||
[Enabled::class, Disabled::class],
|
||||
function ($event) use ($container, $extension) {
|
||||
if ($event->extension === $extension) {
|
||||
$container->make(ActualFormatter::class)->flush();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$events->listen(Enabled::class, $flush);
|
||||
$events->listen(Disabled::class, $flush);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user