コード例 #1
0
 /**
  * @test
  */
 public function buildSetsWidgetContext()
 {
     $_GET = array('fluid-widget-id' => '123');
     $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->with('123')->will($this->returnValue($this->mockWidgetContext));
     $this->mockWidgetRequest->expects($this->once())->method('setWidgetContext')->with($this->mockWidgetContext);
     $this->widgetRequestBuilder->build();
 }
コード例 #2
0
 /**
  * Builds a widget request object from the raw HTTP information
  *
  * @return \TYPO3\CMS\Fluid\Core\Widget\WidgetRequest The widget request as an object
  */
 public function build()
 {
     $request = $this->objectManager->get(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class);
     $request->setRequestUri(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
     $request->setBaseUri(GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
     $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null);
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
         $request->setArguments(GeneralUtility::_POST());
     } else {
         $request->setArguments(GeneralUtility::_GET());
     }
     $rawGetArguments = GeneralUtility::_GET();
     if (isset($rawGetArguments['action'])) {
         $request->setControllerActionName($rawGetArguments['action']);
     }
     $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']);
     $request->setWidgetContext($widgetContext);
     return $request;
 }
コード例 #3
0
 /**
  * Builds a widget request object from the raw HTTP information
  *
  * @return \TYPO3\CMS\Fluid\Core\Widget\WidgetRequest The widget request as an object
  */
 public function build()
 {
     $request = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetRequest');
     $request->setRequestURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
     $request->setBaseURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
     $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : NULL);
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
         $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST());
     } else {
         $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET());
     }
     $rawGetArguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
     // TODO: rename to @action, to be consistent with normal naming?
     if (isset($rawGetArguments['action'])) {
         $request->setControllerActionName($rawGetArguments['action']);
     }
     $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']);
     $request->setWidgetContext($widgetContext);
     return $request;
 }
コード例 #4
0
 /**
  * Builds a widget request object from the raw HTTP information
  *
  * @return \TYPO3\CMS\Fluid\Core\Widget\WidgetRequest The widget request as an object
  */
 public function build()
 {
     $request = $this->objectManager->get(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class);
     $request->setRequestURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
     $request->setBaseURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
     $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null);
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
         $files = $this->untangleFilesArray($_FILES);
         $parameters = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST(), $files);
         $request->setArguments($parameters);
     } else {
         $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET());
     }
     $rawGetArguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
     // @todo rename to @action, to be consistent with normal naming?
     if (isset($rawGetArguments['action'])) {
         $request->setControllerActionName($rawGetArguments['action']);
     }
     $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']);
     $request->setWidgetContext($widgetContext);
     return $request;
 }
コード例 #5
0
 /**
  * Initialize the Widget Context, before the Render method is called.
  *
  * @return void
  */
 private function initializeWidgetContext()
 {
     $this->widgetContext->setWidgetConfiguration($this->getWidgetConfiguration());
     $this->initializeWidgetIdentifier();
     $this->widgetContext->setControllerObjectName(get_class($this->controller));
     $extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
     $pluginName = $this->controllerContext->getRequest()->getPluginName();
     $this->widgetContext->setParentExtensionName($extensionName);
     $this->widgetContext->setParentPluginName($pluginName);
     $pluginNamespace = $this->extensionService->getPluginNamespace($extensionName, $pluginName);
     $this->widgetContext->setParentPluginNamespace($pluginNamespace);
     $this->widgetContext->setWidgetViewHelperClassName(get_class($this));
     if ($this->ajaxWidget === true) {
         $this->ajaxWidgetContextHolder->store($this->widgetContext);
     }
 }
コード例 #6
0
 /**
  * @test
  */
 public function initializeArgumentsAndRenderStoresTheWidgetContextIfInAjaxMode()
 {
     $this->viewHelper->_set('ajaxWidget', TRUE);
     $this->ajaxWidgetContextHolder->expects($this->once())->method('store')->with($this->widgetContext);
     $this->callViewHelper();
 }