‪TYPO3CMS  9.5
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 
25 {
29  protected ‪$supportedRequestTypes = [\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class];
30 
36  protected ‪$widgetConfiguration;
37 
44  public function ‪processRequest(\‪TYPO3\CMS\‪Extbase\Mvc\‪RequestInterface ‪$request, \‪TYPO3\CMS\‪Extbase\Mvc\ResponseInterface ‪$response)
45  {
46  $this->widgetConfiguration = ‪$request->getWidgetContext()->getWidgetConfiguration();
47  parent::processRequest(‪$request, ‪$response);
48  }
49 
56  protected function ‪setViewConfiguration(\‪TYPO3\CMS\‪Extbase\Mvc\View\ViewInterface ‪$view)
57  {
58  $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\‪TYPO3\CMS\‪Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
59  $widgetViewHelperClassName = $this->request->getWidgetContext()->getWidgetViewHelperClassName();
60  $templatePaths = new ‪TemplatePaths($this->controllerContext->getRequest()->getControllerExtensionKey());
61  $parentConfiguration = ‪$view->getTemplatePaths()->toArray();
62  $rootConfiguration = $templatePaths->toArray();
63  $pluginConfiguration = $extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName] ?? [];
64  if (isset($pluginConfiguration['templateRootPath']) && !isset($pluginConfiguration['templateRootPaths'])) {
65  $pluginConfiguration['templateRootPaths'][10] = $pluginConfiguration['templateRootPath'];
66  }
67  $widgetViewConfiguration = array_merge_recursive(
68  (array)$rootConfiguration,
69  (array)$parentConfiguration,
70  (array)$pluginConfiguration
71  );
72  ‪$view->getTemplatePaths()->fillFromConfigurationArray($widgetViewConfiguration);
73  }
74 }
‪TYPO3\CMS\Fluid\Core\Widget
Definition: AbstractWidgetController.php:2
‪TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController\processRequest
‪processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
Definition: AbstractWidgetController.php:42
‪TYPO3\CMS\Fluid\View\TemplatePaths
Definition: TemplatePaths.php:34
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$view
‪ViewInterface $view
Definition: ActionController.php:44
‪TYPO3
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$response
‪TYPO3 CMS Extbase Mvc Response $response
Definition: ActionController.php:93
‪TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController\setViewConfiguration
‪setViewConfiguration(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view)
Definition: AbstractWidgetController.php:54
‪TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController\$supportedRequestTypes
‪array $supportedRequestTypes
Definition: AbstractWidgetController.php:28
‪TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController\$widgetConfiguration
‪array $widgetConfiguration
Definition: AbstractWidgetController.php:34
‪TYPO3\CMS\Extbase\Mvc\RequestInterface
Definition: RequestInterface.php:21
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request
‪TYPO3 CMS Extbase Mvc Request $request
Definition: ActionController.php:87
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:31
‪TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController
Definition: AbstractWidgetController.php:25