mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
initial commit
This commit is contained in:
53
Templating/Twig.php
Normal file
53
Templating/Twig.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user