本文整理汇总了PHP中TYPO3\Flow\Mvc\ActionRequest::setArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionRequest::setArgument方法的具体用法?PHP ActionRequest::setArgument怎么用?PHP ActionRequest::setArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Mvc\ActionRequest
的用法示例。
在下文中一共展示了ActionRequest::setArgument方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* @param array $module
* @return mixed
*/
public function indexAction(array $module)
{
$moduleRequest = new ActionRequest($this->request);
$moduleRequest->setArgumentNamespace('moduleArguments');
$moduleRequest->setControllerObjectName($module['controller']);
$moduleRequest->setControllerActionName($module['action']);
if (isset($module['format'])) {
$moduleRequest->setFormat($module['format']);
}
if ($this->request->hasArgument($moduleRequest->getArgumentNamespace()) === true && is_array($this->request->getArgument($moduleRequest->getArgumentNamespace()))) {
$moduleRequest->setArguments($this->request->getArgument($moduleRequest->getArgumentNamespace()));
}
foreach ($this->request->getPluginArguments() as $argumentNamespace => $argument) {
$moduleRequest->setArgument('--' . $argumentNamespace, $argument);
}
$modules = explode('/', $module['module']);
$moduleConfiguration = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $modules));
$moduleConfiguration['path'] = $module['module'];
if (!$this->menuHelper->isModuleEnabled($moduleConfiguration['path'])) {
throw new DisabledModuleException(sprintf('The module "%s" is disabled. You can enable it with the "enabled" flag in Settings.yaml.', $module['module']), 1437148922);
}
$moduleBreadcrumb = array();
$path = array();
foreach ($modules as $moduleIdentifier) {
array_push($path, $moduleIdentifier);
$config = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $path));
$moduleBreadcrumb[implode('/', $path)] = $config;
}
$moduleRequest->setArgument('__moduleConfiguration', $moduleConfiguration);
$moduleResponse = new Response($this->response);
$this->dispatcher->dispatch($moduleRequest, $moduleResponse);
if ($moduleResponse->hasHeader('Location')) {
$this->redirectToUri($moduleResponse->getHeader('Location'), 0, $moduleResponse->getStatusCode());
} elseif ($moduleRequest->getFormat() !== 'html') {
$mediaType = MediaTypes::getMediaTypeFromFilename('file.' . $moduleRequest->getFormat());
if ($mediaType !== 'application/octet-stream') {
$this->controllerContext->getResponse()->setHeader('Content-Type', $mediaType);
}
return $moduleResponse->getContent();
} else {
$user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
$sites = $this->menuHelper->buildSiteList($this->controllerContext);
$this->view->assignMultiple(array('moduleClass' => implode('-', $modules), 'moduleContents' => $moduleResponse->getContent(), 'title' => $moduleRequest->hasArgument('title') ? $moduleRequest->getArgument('title') : $moduleConfiguration['label'], 'rootModule' => array_shift($modules), 'submodule' => array_shift($modules), 'moduleConfiguration' => $moduleConfiguration, 'moduleBreadcrumb' => $moduleBreadcrumb, 'user' => $user, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $sites));
}
}
示例2: processSubmittedFormValues
/**
* @return void
* @internal
*/
protected function processSubmittedFormValues()
{
$result = $this->mapAndValidatePage($this->lastDisplayedPage);
if ($result->hasErrors() && !$this->userWentBackToPreviousStep()) {
$this->currentPage = $this->lastDisplayedPage;
$this->request->setArgument('__submittedArguments', $this->request->getArguments());
$this->request->setArgument('__submittedArgumentValidationResults', $result);
}
}
示例3: getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid
/**
* @test
* @expectedException \TYPO3\Flow\Security\Exception\InvalidHashException
*/
public function getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid()
{
$serializedArguments = base64_encode('some manipulated arguments string without valid HMAC');
$referrer = array('@controller' => 'Foo', '@action' => 'bar', 'arguments' => $serializedArguments);
$mockHashService = $this->getMockBuilder(\TYPO3\Flow\Security\Cryptography\HashService::class)->getMock();
$mockHashService->expects($this->once())->method('validateAndStripHmac')->with($serializedArguments)->will($this->throwException(new InvalidHashException()));
$this->inject($this->actionRequest, 'hashService', $mockHashService);
$this->actionRequest->setArgument('__referrer', $referrer);
$this->actionRequest->getReferringRequest();
}
示例4: render
/**
* @param string $path
* @return string
* @throws \Exception
*/
public function render($path = NULL)
{
/** @var RequestHandler $activeRequestHandler */
$activeRequestHandler = $this->bootstrap->getActiveRequestHandler();
$parentHttpRequest = $activeRequestHandler->getHttpRequest();
$httpRequest = Request::create(new Uri($parentHttpRequest->getBaseUri() . $path . '.html'));
$matchingRoute = $this->router->route($httpRequest);
if (!$matchingRoute) {
throw new \Exception(sprintf('Uri with path "%s" could not be found.', $parentHttpRequest->getBaseUri() . $path . '.html'), 1426446160);
}
$request = new ActionRequest($parentHttpRequest);
foreach ($matchingRoute as $argumentName => $argumentValue) {
$request->setArgument($argumentName, $argumentValue);
}
$response = new Response($activeRequestHandler->getHttpResponse());
$this->dispatcher->dispatch($request, $response);
return $response->getContent();
}
示例5: getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid
/**
* @test
* @expectedException \TYPO3\Flow\Security\Exception\InvalidHashException
*/
public function getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid()
{
$referrer = array('@controller' => 'Foo', '@action' => 'bar', 'arguments' => base64_encode('some manipulated arguments string without valid HMAC'));
$httpRequest = HttpRequest::create(new Uri('http://acme.com', 'GET'));
$request = new ActionRequest($httpRequest);
$request->setArgument('__referrer', $referrer);
$this->inject($request, 'hashService', new \TYPO3\Flow\Security\Cryptography\HashService());
$request->getReferringRequest();
}