TYPO3 API  SVNRelease
WidgetContext.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This script belongs to the FLOW3 package "Fluid".                      *
00005  *                                                                        *
00006  * It is free software; you can redistribute it and/or modify it under    *
00007  * the terms of the GNU Lesser General Public License as published by the *
00008  * Free Software Foundation, either version 3 of the License, or (at your *
00009  * option) any later version.                                             *
00010  *                                                                        *
00011  * This script is distributed in the hope that it will be useful, but     *
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00013  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
00014  * General Public License for more details.                               *
00015  *                                                                        *
00016  * You should have received a copy of the GNU Lesser General Public       *
00017  * License along with the script.                                         *
00018  * If not, see http://www.gnu.org/licenses/lgpl.html                      *
00019  *                                                                        *
00020  * The TYPO3 project - inspiring people to share!                         *
00021  *                                                                        */
00022 
00023 /**
00024  * The WidgetContext stores all information a widget needs to know about the
00025  * environment.
00026  *
00027  * The WidgetContext can be fetched from the current WidgetRequest, and is thus
00028  * available throughout the whole sub-request of the widget. It is used internally
00029  * by various ViewHelpers (like <f:widget.link>, <f:widget.uri>, <f:widget.renderChildren>),
00030  * to get knowledge over the current widget's configuration.
00031  *
00032  * It is a purely internal class which should not be used outside of Fluid.
00033  *
00034  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
00035  */
00036 class Tx_Fluid_Core_Widget_WidgetContext {
00037 
00038     /**
00039      * Uniquely idenfies a Widget Instance on a certain page.
00040      *
00041      * @var string
00042      */
00043     protected $widgetIdentifier;
00044 
00045     /**
00046      * Per-User unique identifier of the widget, if it is an AJAX widget.
00047      *
00048      * @var string
00049      */
00050     protected $ajaxWidgetIdentifier;
00051 
00052     /**
00053      * User-supplied widget configuration, available inside the widget
00054      * controller as $this->widgetConfiguration.
00055      *
00056      * @var array
00057      */
00058     protected $widgetConfiguration;
00059 
00060     /**
00061      * The fully qualified object name of the Controller which this widget uses.
00062      *
00063      * @var string
00064      */
00065     protected $controllerObjectName;
00066 
00067     /**
00068      * The child nodes of the Widget ViewHelper.
00069      * Only available inside non-AJAX requests.
00070      *
00071      * @var Tx_Fluid_Core_Parser_SyntaxTree_RootNode
00072      * @transient
00073      */
00074     protected $viewHelperChildNodes; // TODO: rename to something more meaningful.
00075 
00076     /**
00077      * The rendering context of the ViewHelperChildNodes.
00078      * Only available inside non-AJAX requests.
00079      *
00080      * @var Tx_Fluid_Core_Rendering_RenderingContextInterface
00081      * @transient
00082      */
00083     protected $viewHelperChildNodeRenderingContext;
00084 
00085     /**
00086      * @var string
00087      */
00088     protected $parentPluginNamespace;
00089 
00090     /**
00091      * @var string
00092      */
00093     protected $parentExtensionName;
00094 
00095     /**
00096      * @var string
00097      */
00098     protected $parentPluginName;
00099 
00100     /**
00101      * @var string
00102      */
00103     protected $widgetViewHelperClassName;
00104 
00105     /**
00106      * @return string
00107      * @author Sebastian Kurfürst <sebastian@typo3.org>
00108      */
00109     public function getWidgetIdentifier() {
00110         return $this->widgetIdentifier;
00111     }
00112 
00113     /**
00114      * @param string $widgetIdentifier
00115      * @return void
00116      * @author Sebastian Kurfürst <sebastian@typo3.org>
00117      */
00118     public function setWidgetIdentifier($widgetIdentifier) {
00119         $this->widgetIdentifier = $widgetIdentifier;
00120     }
00121 
00122     /**
00123      * @return string
00124      * @author Sebastian Kurfürst <sebastian@typo3.org>
00125      */
00126     public function getAjaxWidgetIdentifier() {
00127         return $this->ajaxWidgetIdentifier;
00128     }
00129 
00130     /**
00131      * @param string $ajaxWidgetIdentifier
00132      * @return void
00133      * @author Sebastian Kurfürst <sebastian@typo3.org>
00134      */
00135     public function setAjaxWidgetIdentifier($ajaxWidgetIdentifier) {
00136         $this->ajaxWidgetIdentifier = $ajaxWidgetIdentifier;
00137     }
00138 
00139     /**
00140      * Sets the URI namespace of the plugin that contains the widget
00141      *
00142      * @param string $parentPluginNamespace
00143      * @return void
00144      */
00145     public function setParentPluginNamespace($parentPluginNamespace) {
00146         $this->parentPluginNamespace = $parentPluginNamespace;
00147     }
00148 
00149     /**
00150      * Returns the URI namespace of the plugin that contains the widget
00151      *
00152      * @return string
00153      */
00154     public function getParentPluginNamespace() {
00155         return $this->parentPluginNamespace;
00156     }
00157 
00158     /**
00159      * Sets the Extension name of the plugin that contains the widget
00160      *
00161      * @param string $parentExtensionName
00162      * @return void
00163      */
00164     public function setParentExtensionName($parentExtensionName) {
00165         $this->parentExtensionName = $parentExtensionName;
00166     }
00167 
00168     /**
00169      * Returns the Extension name of the plugin that contains the widget
00170      *
00171      * @return string
00172      */
00173     public function getParentExtensionName() {
00174         return $this->parentExtensionName;
00175     }
00176 
00177     /**
00178      * Sets the name of the plugin that contains the widget
00179      *
00180      * @param string $parentPluginName
00181      * @return void
00182      */
00183     public function setParentPluginName($parentPluginName) {
00184         $this->parentPluginName = $parentPluginName;
00185     }
00186 
00187     /**
00188      * Returns the name of the plugin that contains the widget
00189      *
00190      * @return string
00191      */
00192     public function getParentPluginName() {
00193         return $this->parentPluginName;
00194     }
00195 
00196     /**
00197      * Sets the fully qualified class name of the view helper this context belongs to
00198      *
00199      * @param string $widgetViewHelperClassName
00200      * @return void
00201      */
00202     public function setWidgetViewHelperClassName($widgetViewHelperClassName) {
00203         $this->widgetViewHelperClassName = $widgetViewHelperClassName;
00204     }
00205 
00206     /**
00207      * Returns the fully qualified class name of the view helper this context belongs to
00208      *
00209      * @return string
00210      */
00211     public function getWidgetViewHelperClassName() {
00212         return $this->widgetViewHelperClassName;
00213     }
00214 
00215     /**
00216      * @return array
00217      * @author Sebastian Kurfürst <sebastian@typo3.org>
00218      */
00219     public function getWidgetConfiguration() {
00220         return $this->widgetConfiguration;
00221     }
00222 
00223     /**
00224      * @param array $widgetConfiguration
00225      * @return void
00226      * @author Sebastian Kurfürst <sebastian@typo3.org>
00227      */
00228     public function setWidgetConfiguration($widgetConfiguration) {
00229         $this->widgetConfiguration = $widgetConfiguration;
00230     }
00231 
00232     /**
00233      * @return string
00234      * @author Sebastian Kurfürst <sebastian@typo3.org>
00235      */
00236     public function getControllerObjectName() {
00237         return $this->controllerObjectName;
00238     }
00239 
00240     /**
00241      * @param string $controllerObjectName
00242      * @return void
00243      * @author Sebastian Kurfürst <sebastian@typo3.org>
00244      */
00245     public function setControllerObjectName($controllerObjectName) {
00246         $this->controllerObjectName = $controllerObjectName;
00247     }
00248 
00249     /**
00250      * @param Tx_Fluid_Core_Parser_SyntaxTree_RootNode $viewHelperChildNodes
00251      * @param Tx_Fluid_Core_Rendering_RenderingContextInterface $viewHelperChildNodeRenderingContext
00252      * @return void
00253      * @author Sebastian Kurfürst <sebastian@typo3.org>
00254      */
00255     public function setViewHelperChildNodes(Tx_Fluid_Core_Parser_SyntaxTree_RootNode $viewHelperChildNodes, Tx_Fluid_Core_Rendering_RenderingContextInterface $viewHelperChildNodeRenderingContext) {
00256         $this->viewHelperChildNodes = $viewHelperChildNodes;
00257         $this->viewHelperChildNodeRenderingContext = $viewHelperChildNodeRenderingContext;
00258     }
00259 
00260     /**
00261      * @return Tx_Fluid_Core_Parser_SyntaxTree_RootNode
00262      * @author Sebastian Kurfürst <sebastian@typo3.org>
00263      */
00264     public function getViewHelperChildNodes() {
00265         return $this->viewHelperChildNodes;
00266     }
00267 
00268     /**
00269      * @return Tx_Fluid_Core_Rendering_RenderingContextInterface
00270      * @author Sebastian Kurfürst <sebastian@typo3.org>
00271      */
00272     public function getViewHelperChildNodeRenderingContext() {
00273         return $this->viewHelperChildNodeRenderingContext;
00274     }
00275 
00276     /**
00277      * @return array
00278      */
00279     public function __sleep() {
00280         return array('widgetIdentifier', 'ajaxWidgetIdentifier', 'widgetConfiguration', 'controllerObjectName', 'parentPluginNamespace', 'parentExtensionName', 'parentPluginName', 'widgetViewHelperClassName');
00281     }
00282 }
00283 ?>