From 6119e9ea401913088c370e3412751d66830f13d2 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 7 Dec 2018 02:16:10 +0300 Subject: [PATCH] Themes: New public method getTemplatesBlueprints() - added --- flextype/Themes.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/flextype/Themes.php b/flextype/Themes.php index be0a2266..13bedda7 100644 --- a/flextype/Themes.php +++ b/flextype/Themes.php @@ -142,6 +142,33 @@ class Themes return $templates; } + /** + * Get templates blueprints for current theme + * + * @access public + * @return array + */ + public static function getTemplatesBlueprints() : array + { + $blueprints = []; + + // Get blueprints files + $_blueprints = Filesystem::getFilesList(PATH['themes'] . '/' . Registry::get('system.theme') . '/blueprints/', 'yaml'); + + // If there is any template file then go... + if (count($_blueprints) > 0) { + foreach ($_blueprints as $blueprint) { + if (!is_bool(Themes::_strrevpos($blueprint, '/blueprints/'))) { + $blueprint_name = str_replace('.php', '', substr($blueprint, Themes::_strrevpos($blueprint, '/blueprints/')+strlen('/blueprints/'))); + $blueprints[$blueprint_name] = $blueprint_name; + } + } + } + + // return blueprints + return $blueprints; + } + /** * _strrevpos */