huzaifa_zepcomhuzaifa_zepcom MemberComments: Received thanks: 0 Member since: March 13

I know how to access the snippet in the twig, but how can I do that from the PHP class? We had a way of accessing any snippet from the namespace in SW5, but I am lost how do to achieve the same for SW6. 

Any help is appreciated. 

Answers

  • AlmareAlmare MemberComments: 83 Received thanks: 9 Member since: June 2013

    Use the symfony trannslator as dependency of your service or class and access your snippet like this example.

    $label = $this->translator->trans('your-label');

    Thanked by 1huzaifa_zepcom
Sign In or Register to comment.