diff --git a/flextype/Themes.php b/flextype/Themes.php index f6b17194..e793b95d 100644 --- a/flextype/Themes.php +++ b/flextype/Themes.php @@ -114,6 +114,33 @@ class Themes return new View($template, $variables); } + /** + * Get partials for current theme + * + * @access public + * @return array + */ + public static function getPartials() : array + { + $partials = []; + + // Get templates files + $_partials = Filesystem::getFilesList(PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/partials/', 'php'); + + // If there is any template file then go... + if (count($_partials) > 0) { + foreach ($_partials as $partial) { + if (!is_bool(Themes::_strrevpos($partial, '/partials/'))) { + $partial_name = str_replace('.php', '', substr($partial, Themes::_strrevpos($partial, '/partials/')+strlen('/partials/'))); + $partials[$partial_name] = $partial_name; + } + } + } + + // return partials + return $partials; + } + /** * Get templates for current theme *