1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-13 08:34:19 +02:00

Flextype Core: Assets Twig Extension - updates

This commit is contained in:
Awilum
2019-03-04 15:04:21 +03:00
parent fd274fa874
commit fedfaef111
2 changed files with 6 additions and 1 deletions

View File

@@ -282,6 +282,10 @@ $flextype['view'] = function ($container) {
// Add I18n Twig Extension
$view->addExtension(new I18nTwigExtension());
// Add Assets Twig Extension
$view->addExtension(new AssetsTwigExtension());
// Return view
return $view;
};

View File

@@ -24,13 +24,14 @@ class AssetsTwigExtension extends \Twig_Extension
public function getFunctions()
{
return [
new \Twig_SimpleFunction('assets_add', array($this, 'add')),
new \Twig_SimpleFunction('assets_get', array($this, 'get')),
];
}
public function add(string $asset_type, string $asset, string $namespace, int $priority = 1) : void
{
return Assets::add($asset_type, $asset, $namespace, $priority);
Assets::add($asset_type, $asset, $namespace, $priority);
}
public function get(string $asset_type, string $namespace) : array