Skip to content

Commit

Permalink
Only register if FormatterRuntime does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jan 17, 2025
1 parent 5be8d09 commit b6c171e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Twig/NotificationCenterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Terminal42\NotificationCenterBundle\Twig;

use Contao\CoreBundle\Twig\Runtime\FormatterRuntime;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
Expand All @@ -19,6 +20,11 @@ public function getFunctions(): array

public function getFilters(): array
{
// This class only exists in Contao 5 and provides the format_bytes filter.
if (class_exists(FormatterRuntime::class)) {
return [];
}

return [
new TwigFilter(
'format_bytes',
Expand Down

0 comments on commit b6c171e

Please sign in to comment.