mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-09 14:33:44 +00:00
apply rector rules
This commit is contained in:
@@ -13,9 +13,7 @@ namespace Chill\MainBundle\Templating;
|
||||
|
||||
use Symfony\Bridge\Twig\Extension\RoutingExtension;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\Node\Node;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
/**
|
||||
@@ -23,7 +21,7 @@ use Twig\TwigFunction;
|
||||
*
|
||||
* The logic of the function is based on the original routing extension.
|
||||
*/
|
||||
class ChillTwigRoutingHelper extends AbstractExtension
|
||||
class ChillTwigRoutingHelper
|
||||
{
|
||||
/**
|
||||
* @var RoutingExtension
|
||||
@@ -43,13 +41,6 @@ class ChillTwigRoutingHelper extends AbstractExtension
|
||||
$this->originalExtension = $originalExtension;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)),
|
||||
];
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
@@ -82,6 +73,7 @@ class ChillTwigRoutingHelper extends AbstractExtension
|
||||
return $this->originalExtension->getPath($name, $params, $relative);
|
||||
}
|
||||
|
||||
#[\Twig\Attribute\AsTwigFilter('chill_return_path_label')]
|
||||
public function getLabelReturnPath($default)
|
||||
{
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
@@ -12,31 +12,15 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Templating;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\Extension\ExtensionInterface;
|
||||
|
||||
class TranslatableStringTwig extends AbstractExtension
|
||||
class TranslatableStringTwig
|
||||
{
|
||||
/**
|
||||
* TranslatableStringTwig constructor.
|
||||
*/
|
||||
public function __construct(private readonly TranslatableStringHelper $helper) {}
|
||||
|
||||
/**
|
||||
* Returns a list of filters to add to the existing list.
|
||||
*
|
||||
* (non-PHPdoc)
|
||||
*
|
||||
* @see Twig_Extension::getFilters()
|
||||
*/
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter(
|
||||
'localize_translatable_string',
|
||||
$this->localize(...)
|
||||
), ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*/
|
||||
@@ -45,6 +29,7 @@ class TranslatableStringTwig extends AbstractExtension
|
||||
return 'chill_main_localize';
|
||||
}
|
||||
|
||||
#[\Twig\Attribute\AsTwigFilter('localize_translatable_string')]
|
||||
public function localize(array $translatableStrings): ?string
|
||||
{
|
||||
return $this->helper
|
||||
|
||||
Reference in New Issue
Block a user