mirror of
https://github.com/flextype/flextype.git
synced 2025-08-09 14:46:53 +02:00
Themes: New public method getThemeTemplates() - added
This commit is contained in:
@@ -115,6 +115,33 @@ class Themes
|
||||
return new View($template, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get theme templates
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public static function getThemeTemplates() : array
|
||||
{
|
||||
$templates = [];
|
||||
|
||||
// Get templates files
|
||||
$_templates = Filesystem::getFilesList(PATH['themes'] . '/' . Registry::get('system.theme') . '/views/templates/', 'php');
|
||||
|
||||
// If there is any template file then go...
|
||||
if (count($_templates) > 0) {
|
||||
foreach ($_templates as $template) {
|
||||
if (!is_bool(Themes::_strrevpos($template, '/templates/'))) {
|
||||
$template_name = str_replace('.php', '', substr($template, Themes::_strrevpos($template, '/templates/')+strlen('/templates/')));
|
||||
$templates[$template_name] = $template_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return templates
|
||||
return $templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* _strrevpos
|
||||
*/
|
||||
|
Reference in New Issue
Block a user