mirror of
https://github.com/flextype/flextype.git
synced 2025-08-12 16:14:16 +02:00
Flextype Core: Assets Twig Extension - added
This commit is contained in:
35
flextype/twig/AssetsTwigExtension.php
Normal file
35
flextype/twig/AssetsTwigExtension.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
*
|
||||
* @author Sergey Romanenko <hello@romanenko.digital>
|
||||
* @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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user