/** * Pass the arguments of the widget to the sub request. * * @param ActionRequest $subRequest * @return void */ private function passArgumentsToSubRequest(ActionRequest $subRequest) { $arguments = $this->controllerContext->getRequest()->getPluginArguments(); $widgetIdentifier = $this->widgetContext->getWidgetIdentifier(); $controllerActionName = 'index'; if (isset($arguments[$widgetIdentifier])) { if (isset($arguments[$widgetIdentifier]['@action'])) { $controllerActionName = $arguments[$widgetIdentifier]['@action']; unset($arguments[$widgetIdentifier]['@action']); } $subRequest->setArguments($arguments[$widgetIdentifier]); } if ($subRequest->getControllerActionName() === null) { $subRequest->setControllerActionName($controllerActionName); } }
/** * @test */ public function widgetIdentifierCanBeReadAgain() { $this->widgetContext->setWidgetIdentifier('myWidgetIdentifier'); $this->assertEquals('myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier()); }