36 lines
1.5 KiB
PHP
36 lines
1.5 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']]),
|
|
new TwigFunction('is_participant_eligible', [AppRuntime::class, 'isParticipantEligible']),
|
|
new TwigFunction('qa_attribute', [AppRuntime::class, 'renderQaAttribute'], ['is_safe' => ['html']]),
|
|
new TwigFunction('is_static_text', [AppRuntime::class, 'isStaticText']),
|
|
new TwigFunction('is_hidden', [AppRuntime::class, 'isHidden']),
|
|
new TwigFunction('gravatar_url', [AppRuntime::class, 'getGravatarUrl']),
|
|
];
|
|
}
|
|
}
|