Browse Source

TwigExtension : ajout user_current

feature/symfony6.1
Guillaume 3 years ago
parent
commit
e934b615d7
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      Twig/TwigExtension.php

+ 6
- 0
Twig/TwigExtension.php View File

@@ -85,6 +85,7 @@ class TwigExtension extends AbstractExtension
new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']),
new TwigFunction('sov_limit_text', [$this, 'limitText']),
new TwigFunction('day_by_number', [$this, 'getDayByNumber']),
new TwigFunction('user_current', [$this, 'getUserCurrent']),
];
}

@@ -185,4 +186,9 @@ class TwigExtension extends AbstractExtension
return $this->stringComponent->slugify($string) ;
}

public function getUserCurrent()
{
return $this->security->getUser();
}

}

Loading…
Cancel
Save