[TASK] Streamline phpdoc annotations in EXT:fluid
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / Core / Widget / WidgetRequestHandler.php
1 <?php
2 namespace TYPO3\CMS\Fluid\Core\Widget;
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
17 /**
18 * Widget request handler, which handles the request if
19 * f3-fluid-widget-id is found.
20 *
21 * This Request Handler gets the WidgetRequestBuilder injected.
22 * @internal It is a purely internal class which should not be used outside of Fluid.
23 */
24 class WidgetRequestHandler extends \TYPO3\CMS\Extbase\Mvc\Web\AbstractRequestHandler
25 {
26 /**
27 * @var \TYPO3\CMS\Fluid\Core\Widget\AjaxWidgetContextHolder
28 */
29 protected $ajaxWidgetContextHolder;
30
31 /**
32 * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
33 */
34 protected $configurationManager;
35
36 /**
37 * @var \TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder
38 */
39 protected $requestBuilder;
40
41 /**
42 * @param \TYPO3\CMS\Fluid\Core\Widget\AjaxWidgetContextHolder $ajaxWidgetContextHolder
43 */
44 public function injectAjaxWidgetContextHolder(\TYPO3\CMS\Fluid\Core\Widget\AjaxWidgetContextHolder $ajaxWidgetContextHolder)
45 {
46 $this->ajaxWidgetContextHolder = $ajaxWidgetContextHolder;
47 }
48
49 /**
50 * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
51 */
52 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
53 {
54 $this->configurationManager = $configurationManager;
55 }
56
57 /**
58 * @param \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder $requestBuilder
59 */
60 public function injectRequestBuilder(\TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder $requestBuilder)
61 {
62 // This method intentionally left blank
63 }
64
65 /**
66 * @param \TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder $requestBuilder
67 */
68 public function injectWidgetRequestBuilder(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder $requestBuilder)
69 {
70 $this->requestBuilder = $requestBuilder;
71 }
72
73 /**
74 * Handles the web request. The response will automatically be sent to the client.
75 *
76 * @return \TYPO3\CMS\Extbase\Mvc\Web\Response
77 */
78 public function handleRequest()
79 {
80 $request = $this->requestBuilder->build();
81 $response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
82 $this->dispatcher->dispatch($request, $response);
83 return $response;
84 }
85
86 /**
87 * @return bool TRUE if it is an AJAX widget request
88 */
89 public function canHandleRequest()
90 {
91 $rawGetArguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
92 return isset($rawGetArguments['fluid-widget-id']);
93 }
94
95 /**
96 * This request handler has a higher priority than the default request handler.
97 *
98 * @return int
99 */
100 public function getPriority()
101 {
102 return 200;
103 }
104 }