mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
/*
|
|
*
|
|
*/
|
|
namespace Chill\AMLI\FamilyMembersBundle\Templating;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
use Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository;
|
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
*/
|
|
class Twig extends AbstractExtension
|
|
{
|
|
/**
|
|
*
|
|
* @var ConfigRepository
|
|
*/
|
|
protected $configRepository;
|
|
|
|
/**
|
|
*
|
|
* @var TranslatableStringHelper
|
|
*/
|
|
protected $translatableStringHelper;
|
|
|
|
public function __construct(
|
|
ConfigRepository $configRepository,
|
|
TranslatableStringHelper $translatableStringHelper
|
|
) {
|
|
$this->configRepository = $configRepository;
|
|
$this->translatableStringHelper = $translatableStringHelper;
|
|
}
|
|
|
|
|
|
public function getFilters()
|
|
{
|
|
return [
|
|
new \Twig_Filter('family_member_link_display', [ $this, 'displayLink' ], [ 'is_safe' => [ 'html' ]])
|
|
];
|
|
}
|
|
|
|
public function displayLink($link)
|
|
{
|
|
return $this->translatableStringHelper->localize(
|
|
$this->configRepository->getLinksLabels()[$link]
|
|
);
|
|
}
|
|
|
|
}
|