From 94d3969c7a73dc56b8e2fbad5fb008aa52a7e7f4 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 1 Jul 2019 23:42:14 +0300 Subject: [PATCH] Flextype Core: FilesystemTwigExtension #165 - new twig function filesystem_get_files_list added. --- flextype/twig/FilesystemTwigExtension.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flextype/twig/FilesystemTwigExtension.php b/flextype/twig/FilesystemTwigExtension.php index 28517ed2..456b4ea6 100644 --- a/flextype/twig/FilesystemTwigExtension.php +++ b/flextype/twig/FilesystemTwigExtension.php @@ -24,6 +24,7 @@ class FilesystemTwigExtension extends \Twig_Extension public function getFunctions() { return [ + new \Twig_SimpleFunction('filesystem_get_files_list', [$this, 'get_files_list']), new \Twig_SimpleFunction('filesystem_has', [$this, 'has']), new \Twig_SimpleFunction('filesystem_read', [$this, 'read']), new \Twig_SimpleFunction('filesystem_ext', [$this, 'ext']), @@ -31,6 +32,11 @@ class FilesystemTwigExtension extends \Twig_Extension ]; } + public function get_files_list(string $folder, $type = null, bool $file_path = true, bool $multilevel = true) + { + return Filesystem::getFilesList($folder, $type, $file_path, $multilevel); + } + public function has($path) { return Filesystem::has($path);