[TASK] Refactor ModuleTemplate path assignments 64/43864/2
authorOliver Hader <oliver@typo3.org>
Tue, 6 Oct 2015 15:19:55 +0000 (17:19 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Oct 2015 18:54:55 +0000 (20:54 +0200)
* use paths (plural) instead of single path definition
* allow access to the view to override/extend the paths to be used

Resolves: #70439
Releases: master
Change-Id: I4467834046de134ebbb1fb16e03b4dbcfa49d0e1
Reviewed-on: http://review.typo3.org/43864
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Template/ModuleTemplate.php

index 3356875..e771479 100644 (file)
@@ -88,23 +88,23 @@ class ModuleTemplate {
        /**
         * TemplateRootPath
         *
-        * @var string
+        * @var string[]
         */
-       protected $templateRootPath = 'EXT:backend/Resources/Private/Templates';
+       protected $templateRootPaths = ['EXT:backend/Resources/Private/Templates'];
 
        /**
         * PartialRootPath
         *
-        * @var string
+        * @var string[]
         */
-       protected $partialRootPath = 'EXT:backend/Resources/Private/Partials';
+       protected $partialRootPaths = ['EXT:backend/Resources/Private/Partials'];
 
        /**
         * LayoutRootPath
         *
-        * @var string
+        * @var string[]
         */
-       protected $layoutRootPath = 'EXT:backend/Resources/Private/Layouts';
+       protected $layoutRootPaths = ['EXT:backend/Resources/Private/Layouts'];
 
        /**
         * Template name
@@ -163,19 +163,18 @@ class ModuleTemplate {
        protected $title = '';
 
        /**
-        * Get template root path
+        * Gets the standalone view.
         *
-        * @return string
+        * @return StandaloneView
         */
-       public function getTemplateRootPath() {
-               return $this->templateRootPath;
+       public function getView() {
+               return $this->view;
        }
 
        /**
         * Set content
         *
         * @param string $content Content of the module
-        *
         * @return void
         */
        public function setContent($content) {
@@ -208,9 +207,9 @@ class ModuleTemplate {
         */
        public function __construct() {
                $this->view = GeneralUtility::makeInstance(StandaloneView::class);
-               $this->view->setPartialRootPaths([$this->partialRootPath]);
-               $this->view->setTemplateRootPaths([$this->templateRootPath]);
-               $this->view->setLayoutRootPaths([$this->layoutRootPath]);
+               $this->view->setPartialRootPaths($this->partialRootPaths);
+               $this->view->setTemplateRootPaths($this->templateRootPaths);
+               $this->view->setLayoutRootPaths($this->layoutRootPaths);
                $this->view->setTemplate($this->templateFile);
                $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);