for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the WPFoundation library.
*
* Copyright (c) 2015-present LIN3S <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use LIN3S\WPFoundation\Translations;
use Twig\Environment;
use Twig\TwigFunction;
/**
* @author Beñat Espiña <[email protected]>
class TranslatorTwigFunction
{
public function __construct()
add_action('twig_apply_filters', function (Environment $twig) {
add_action()
$twig->addFunction(
new TwigFunction('trans', function ($key) {
return Translations::trans($key);
})
);
return $twig;
});
}