31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Twig;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFilter;
|
|
use Twig\TwigFunction;
|
|
|
|
class AppExtension extends AbstractExtension
|
|
{
|
|
public function getFilters(): array
|
|
{
|
|
return [
|
|
new TwigFilter('file_size', [AppRuntime::class, 'formatBytes']),
|
|
new TwigFilter('file_icon', [AppRuntime::class, 'fileIconFilter'], ['is_safe' => ['html']]),
|
|
new TwigFilter('format_money', [AppRuntime::class, 'formatMoney']),
|
|
new TwigFilter('map_gender', [AppRuntime::class, 'mapGender']),
|
|
new TwigFilter('map_status', [AppRuntime::class, 'mapStatus']),
|
|
new TwigFilter('map_country', [AppRuntime::class, 'mapCountry']),
|
|
new TwigFilter('map_nationality', [AppRuntime::class, 'mapNationality']),
|
|
];
|
|
}
|
|
|
|
public function getFunctions(): array
|
|
{
|
|
return [
|
|
new TwigFunction('icon', [AppRuntime::class, 'renderIcon'], ['needs_environment' => true, 'is_safe' => ['html']]),
|
|
];
|
|
}
|
|
}
|