TYPO3 CMS  TYPO3_8-7
AbstractWidgetController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
27 {
31  protected $supportedRequestTypes = [\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class];
32 
40 
48  public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
49  {
50  $this->widgetConfiguration = $request->getWidgetContext()->getWidgetConfiguration();
51  parent::processRequest($request, $response);
52  }
53 
60  protected function setViewConfiguration(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view)
61  {
62  $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
63  $widgetViewHelperClassName = $this->request->getWidgetContext()->getWidgetViewHelperClassName();
64  $templatePaths = new TemplatePaths($this->controllerContext->getRequest()->getControllerExtensionKey());
65  $widgetViewConfiguration = null;
66  $parentConfiguration = $view->getTemplatePaths()->toArray();
67  $rootConfiguration = $templatePaths->toArray();
68  $pluginConfiguration = $extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName] ?? [];
69  if (isset($pluginConfiguration['templateRootPath']) && !isset($pluginConfiguration['templateRootPaths'])) {
70  $pluginConfiguration['templateRootPaths'][10] = $pluginConfiguration['templateRootPath'];
71  }
72  $widgetViewConfiguration = array_merge_recursive(
73  (array)$rootConfiguration,
74  (array)$parentConfiguration,
75  (array)$pluginConfiguration
76  );
77  $view->getTemplatePaths()->fillFromConfigurationArray($widgetViewConfiguration);
78  }
79 }
setViewConfiguration(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view)
processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)