mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
That should do the trick
This commit is contained in:
parent
ad165561b9
commit
7077becfad
2 changed files with 7 additions and 3 deletions
|
|
@ -25,7 +25,6 @@
|
|||
<service id="sylius_resource.fetcher" class="%sylius_resource.fetcher.class%" />
|
||||
|
||||
<service id="sylius_resource.twig" class="%sylius_resource.twig.class%">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument type="service" id="router" />
|
||||
<tag name="twig.extension" />
|
||||
</service>
|
||||
|
|
|
|||
|
|
@ -27,9 +27,8 @@ class SyliusResourceExtension extends Twig_Extension
|
|||
private $request;
|
||||
private $router;
|
||||
|
||||
public function __construct(ContainerInterface $container, RouterInterface $router)
|
||||
public function __construct(RouterInterface $router)
|
||||
{
|
||||
$this->request = $container->get('request');
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
|
|
@ -39,10 +38,16 @@ class SyliusResourceExtension extends Twig_Extension
|
|||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
'sylius_resource_fetch_request' => new Twig_Function_Method($this, 'fetchRequest'),
|
||||
'sylius_resource_sort' => new Twig_Function_Method($this, 'renderSortingLink', array('is_safe' => array('html'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function fetchRequest(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function renderSortingLink($property, $label = null, $order = null, $route = null)
|
||||
{
|
||||
$label = null === $label ? $property : $label;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue