mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 00:24:15 +02:00
Flextype: FilesystemTwigExtension - added
This commit is contained in:
41
flextype/twig/FilesystemTwigExtension.php
Normal file
41
flextype/twig/FilesystemTwigExtension.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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\Filesystem\Filesystem;
|
||||
|
||||
class FilesystemTwigExtension extends \Twig_Extension
|
||||
{
|
||||
/**
|
||||
* Callback for twig.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new \Twig_SimpleFunction('filesystem_has', array($this, 'filesystem_has')),
|
||||
new \Twig_SimpleFunction('filesystem_read', array($this, 'filesystem_read')),
|
||||
];
|
||||
}
|
||||
|
||||
public function has($path)
|
||||
{
|
||||
return Filesystem::has($path);
|
||||
}
|
||||
|
||||
public function read($path)
|
||||
{
|
||||
return Filesystem::read($path);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user