Completed
Push — master ( 794c22...18e3f4 )
by
unknown
22:38
created

WidgetContext::setParentPluginNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
 */
15
16
namespace TYPO3\CMS\Fluid\Core\Widget;
17
18
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode;
19
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
20
21
/**
22
 * The WidgetContext stores all information a widget needs to know about the
23
 * environment.
24
 *
25
 * The WidgetContext can be fetched from the current WidgetRequest, and is thus
26
 * available throughout the whole sub-request of the widget. It is used internally
27
 * by various ViewHelpers (like <f:widget.link>, <f:widget.uri>, <f:widget.renderChildren>),
28
 * to get knowledge over the current widget's configuration.
29
 *
30
 * @internal It is a purely internal class which should not be used outside of Fluid.
31
 */
32
class WidgetContext
33
{
34
    /**
35
     * Uniquely identifies a Widget Instance on a certain page.
36
     *
37
     * @var string
38
     */
39
    protected $widgetIdentifier;
40
41
    /**
42
     * Per-User unique identifier of the widget, if it is an AJAX widget.
43
     *
44
     * @var string
45
     */
46
    protected $ajaxWidgetIdentifier;
47
48
    /**
49
     * User-supplied widget configuration, available inside the widget
50
     * controller as $this->widgetConfiguration.
51
     *
52
     * @var array
53
     */
54
    protected $widgetConfiguration;
55
56
    /**
57
     * The fully qualified object name of the Controller which this widget uses.
58
     *
59
     * @var string
60
     */
61
    protected $controllerObjectName;
62
63
    /**
64
     * The child nodes of the Widget ViewHelper.
65
     * Only available inside non-AJAX requests.
66
     *
67
     * @var \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode
68
     */
69
    protected $viewHelperChildNodes;
70
71
    /**
72
     * The rendering context of the ViewHelperChildNodes.
73
     * Only available inside non-AJAX requests.
74
     * @todo rename to something more meaningful.
75
     *
76
     * @var \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
77
     */
78
    protected $viewHelperChildNodeRenderingContext;
79
80
    /**
81
     * @var string
82
     */
83
    protected $parentPluginNamespace;
84
85
    /**
86
     * @var string
87
     */
88
    protected $parentExtensionName;
89
90
    /**
91
     * @var string
92
     */
93
    protected $parentPluginName;
94
95
    /**
96
     * @var string
97
     */
98
    protected $widgetViewHelperClassName;
99
100
    /**
101
     * @return string
102
     */
103
    public function getWidgetIdentifier()
104
    {
105
        return $this->widgetIdentifier;
106
    }
107
108
    /**
109
     * @param string $widgetIdentifier
110
     */
111
    public function setWidgetIdentifier($widgetIdentifier)
112
    {
113
        $this->widgetIdentifier = $widgetIdentifier;
114
    }
115
116
    /**
117
     * @return string
118
     */
119
    public function getAjaxWidgetIdentifier()
120
    {
121
        return $this->ajaxWidgetIdentifier;
122
    }
123
124
    /**
125
     * @param string $ajaxWidgetIdentifier
126
     */
127
    public function setAjaxWidgetIdentifier($ajaxWidgetIdentifier)
128
    {
129
        $this->ajaxWidgetIdentifier = $ajaxWidgetIdentifier;
130
    }
131
132
    /**
133
     * Sets the URI namespace of the plugin that contains the widget
134
     *
135
     * @param string $parentPluginNamespace
136
     */
137
    public function setParentPluginNamespace($parentPluginNamespace)
138
    {
139
        $this->parentPluginNamespace = $parentPluginNamespace;
140
    }
141
142
    /**
143
     * Returns the URI namespace of the plugin that contains the widget
144
     *
145
     * @return string
146
     */
147
    public function getParentPluginNamespace()
148
    {
149
        return $this->parentPluginNamespace;
150
    }
151
152
    /**
153
     * Sets the Extension name of the plugin that contains the widget
154
     *
155
     * @param string $parentExtensionName
156
     */
157
    public function setParentExtensionName($parentExtensionName)
158
    {
159
        $this->parentExtensionName = $parentExtensionName;
160
    }
161
162
    /**
163
     * Returns the Extension name of the plugin that contains the widget
164
     *
165
     * @return string
166
     */
167
    public function getParentExtensionName()
168
    {
169
        return $this->parentExtensionName;
170
    }
171
172
    /**
173
     * Sets the name of the plugin that contains the widget
174
     *
175
     * @param string $parentPluginName
176
     */
177
    public function setParentPluginName($parentPluginName)
178
    {
179
        $this->parentPluginName = $parentPluginName;
180
    }
181
182
    /**
183
     * Returns the name of the plugin that contains the widget
184
     *
185
     * @return string
186
     */
187
    public function getParentPluginName()
188
    {
189
        return $this->parentPluginName;
190
    }
191
192
    /**
193
     * Sets the fully qualified class name of the view helper this context belongs to
194
     *
195
     * @param string $widgetViewHelperClassName
196
     */
197
    public function setWidgetViewHelperClassName($widgetViewHelperClassName)
198
    {
199
        $this->widgetViewHelperClassName = $widgetViewHelperClassName;
200
    }
201
202
    /**
203
     * Returns the fully qualified class name of the view helper this context belongs to
204
     *
205
     * @return string
206
     */
207
    public function getWidgetViewHelperClassName()
208
    {
209
        return $this->widgetViewHelperClassName;
210
    }
211
212
    /**
213
     * @return array
214
     */
215
    public function getWidgetConfiguration()
216
    {
217
        return $this->widgetConfiguration;
218
    }
219
220
    /**
221
     * @param array $widgetConfiguration
222
     */
223
    public function setWidgetConfiguration($widgetConfiguration)
224
    {
225
        $this->widgetConfiguration = $widgetConfiguration;
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getControllerObjectName()
232
    {
233
        return $this->controllerObjectName;
234
    }
235
236
    /**
237
     * @param string $controllerObjectName
238
     */
239
    public function setControllerObjectName($controllerObjectName)
240
    {
241
        $this->controllerObjectName = $controllerObjectName;
242
    }
243
244
    /**
245
     * @param \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode $viewHelperChildNodes
246
     * @param \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $viewHelperChildNodeRenderingContext
247
     */
248
    public function setViewHelperChildNodes(RootNode $viewHelperChildNodes, RenderingContextInterface $viewHelperChildNodeRenderingContext)
249
    {
250
        $this->viewHelperChildNodes = $viewHelperChildNodes;
251
        $this->viewHelperChildNodeRenderingContext = $viewHelperChildNodeRenderingContext;
252
    }
253
254
    /**
255
     * @return \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode
256
     */
257
    public function getViewHelperChildNodes()
258
    {
259
        return $this->viewHelperChildNodes;
260
    }
261
262
    /**
263
     * @return \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
264
     */
265
    public function getViewHelperChildNodeRenderingContext()
266
    {
267
        return $this->viewHelperChildNodeRenderingContext;
268
    }
269
270
    /**
271
     * @return array
272
     */
273
    public function __sleep()
274
    {
275
        return ['widgetIdentifier', 'ajaxWidgetIdentifier', 'widgetConfiguration', 'controllerObjectName', 'parentPluginNamespace', 'parentExtensionName', 'parentPluginName', 'widgetViewHelperClassName'];
276
    }
277
}
278