mirror of
https://github.com/flextype/flextype.git
synced 2025-08-15 17:44:17 +02:00
Themes: getPartials() method added
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user