public function availableViewsList()
{
$views = array();
$viewLocations = $this->Config->get('view');
$humanNames = $this->Config->get('view.template_human_names');
foreach ($viewLocations['paths'] as $path) {
if (!$this->File->exists($path)) {
continue;
}
$files = $this->File->allFiles($path);
foreach ($files as $file) {
if (substr_count($file->getRelativePathname(), '.blade.php')) {
$value = str_replace('/', '.', str_replace('.blade.php', '', $file->getRelativePathname()));
$nameArr = explode('.', $value);
// added in case you have a file directory within the views directory
// then you will see a big fat error because there is no index [1] below
if (count($nameArr) < 2) {
continue;
}
$folderName = $nameArr[0];
$viewName = $nameArr[1];
if (substr($viewName, 0, 1) != '_' && $folderName == 'templates') {
$views[$value] = isset($humanNames[$value]) ? $humanNames[$value] : $value;
}
}
}
}
asort($views);
return $views;
}