public function getAvailableTemplatesAction()
{
$templates = [];
$viewPath = PIMCORE_WEBSITE_PATH . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . "scripts";
$files = rscandir($viewPath . DIRECTORY_SEPARATOR);
foreach ($files as $file) {
$dat = [];
if (strpos($file, \Pimcore\View::getViewScriptSuffix()) !== false) {
$dat["path"] = str_replace($viewPath, "", $file);
$dat["path"] = str_replace("\\", "/", $dat["path"]);
// unix directory separator are compatible with windows, not the reverse
$templates[] = $dat;
}
}
$this->_helper->json(["data" => $templates]);
}