Exemplo n.º 1
0
 /**
  * Handles the index action
  *
  * @return string
  */
 public function indexAction()
 {
     $layoutGroups = array_map(function ($elementType) {
         return ["title" => ucfirst($elementType) . "s", "elementType" => $elementType, "elements" => $this->elementTypesModel->getListedElements($elementType)];
     }, $this->elementTypesModel->getAllElementTypes());
     return $this->twig->render("@core/index.twig", ["layoutGroups" => $layoutGroups, "downloads" => $this->downloadModel->getAllDownloads()]);
 }
Exemplo n.º 2
0
 /**
  * Registers all models and all twig layout namespaces
  *
  * @param string $baseDir
  */
 private function registerModelsAndTwigLayoutNamespaces($baseDir)
 {
     $elementTypesModel = new ElementTypesModel($baseDir);
     // model
     $this["model.element_types"] = $elementTypesModel;
     $this["model.download"] = new DownloadModel($baseDir);
     // twig template namespaces
     foreach ($elementTypesModel->getAllElementTypes() as $elementType) {
         $this["twig.loader.filesystem"]->addPath($elementTypesModel->getUserSubDirectory("{$elementType}s"), $elementType);
     }
     $this["twig.loader.filesystem"]->addPath($elementTypesModel->getUserSubDirectory("_base"), "base");
 }