From 083b583b78b10650d402c3eabdd5f71a9c5a3919 Mon Sep 17 00:00:00 2001
From: Susanne Moog <susanne.moog@typo3.com>
Date: Sat, 31 Dec 2016 10:59:38 +0100
Subject: [PATCH] [FEATURE] Allow definition of template paths in backend
 module

BackendTemplateView now allows overwriting of template paths to add your own
locations for templates, partials and layouts in a BackendTemplateView based
backend module.

Change-Id: I2d8c4b432ff23a3e9b8b527af4697f31082f64b7
Releases: master
Resolves: #79124
Reviewed-on: https://review.typo3.org/51079
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Mona Muzaffar
Reviewed-by: Mona Muzaffar
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 .../Classes/View/BackendTemplateView.php      | 36 +++++++++++++++++++
 ...ngOfTemplatePathsInBackendTemplateView.rst | 33 +++++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-79124-AllowOverwritingOfTemplatePathsInBackendTemplateView.rst

diff --git a/typo3/sysext/backend/Classes/View/BackendTemplateView.php b/typo3/sysext/backend/Classes/View/BackendTemplateView.php
index 329f7e1d3977..17c42a4b33bc 100644
--- a/typo3/sysext/backend/Classes/View/BackendTemplateView.php
+++ b/typo3/sysext/backend/Classes/View/BackendTemplateView.php
@@ -137,4 +137,40 @@ class BackendTemplateView implements ViewInterface
     {
         $this->templateView->initializeView();
     }
+
+    /**
+     * Set the root path(s) to the templates.
+     *
+     * @param array $templateRootPaths Root path(s) to the templates.
+     * @return void
+     * @api
+     */
+    public function setTemplateRootPaths(array $templateRootPaths)
+    {
+        $this->templateView->setTemplateRootPaths($templateRootPaths);
+    }
+
+    /**
+     * Set the root path(s) to the partials.
+     *
+     * @param array $partialRootPaths Root paths to the partials.
+     * @return void
+     * @api
+     */
+    public function setPartialRootPaths(array $partialRootPaths)
+    {
+        $this->templateView->setPartialRootPaths($partialRootPaths);
+    }
+
+    /**
+     * Set the root path(s) to the layouts.
+     *
+     * @param array $layoutRootPaths Root path to the layouts.
+     * @return void
+     * @api
+     */
+    public function setLayoutRootPaths(array $layoutRootPaths)
+    {
+        $this->templateView->setLayoutRootPaths($layoutRootPaths);
+    }
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-79124-AllowOverwritingOfTemplatePathsInBackendTemplateView.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-79124-AllowOverwritingOfTemplatePathsInBackendTemplateView.rst
new file mode 100644
index 000000000000..59d41012b646
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-79124-AllowOverwritingOfTemplatePathsInBackendTemplateView.rst
@@ -0,0 +1,33 @@
+.. include:: ../../Includes.txt
+
+============================================================================
+Feature: #79124 - Allow overwriting of template paths in BackendTemplateView
+============================================================================
+
+See :issue:`79124`
+
+Description
+===========
+
+BackendTemplateView now allows overwriting of template paths to add your own locations for templates, partials and layouts in a BackendTemplateView based backend module.
+
+Impact
+======
+
+You can now do for example
+
+.. code-block:: php
+
+	$frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+	$viewConfiguration = [
+	   'view' => [
+	       'templateRootPaths' => ['EXT:myext/Resources/Private/Backend/Templates'],
+	       'partialRootPaths' => ['EXT:myext/Resources/Private/Backend/Partials'],
+	       'layoutRootPaths' => ['EXT:myext/Resources/Private/Backend/Layouts'],
+	   ],
+	];
+	$this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $viewConfiguration));
+
+
+
+.. index:: Backend, PHP-API
-- 
GitLab