diff --git a/flextype/twig/AssetsTwigExtension.php b/flextype/twig/AssetsTwigExtension.php new file mode 100644 index 00000000..ba1bac6b --- /dev/null +++ b/flextype/twig/AssetsTwigExtension.php @@ -0,0 +1,35 @@ + + * @link http://romanenko.digital + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Flextype; + +use Flextype\Component\Assets\Assets; + +class AssetsTwigExtension extends \Twig_Extension +{ + /** + * Callback for twig. + * + * @return array + */ + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('assets_get', array($this, 'get')), + ]; + } + + public function get(string $asset_type, string $namespace) : array + { + return Assets::get($asset_type, $namespace); + } +}