本文整理汇总了PHP中TYPO3\Flow\Mvc\ActionRequest::setArguments方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionRequest::setArguments方法的具体用法?PHP ActionRequest::setArguments怎么用?PHP ActionRequest::setArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Mvc\ActionRequest
的用法示例。
在下文中一共展示了ActionRequest::setArguments方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createActionRequest
/**
* @param Request $httpRequest
* @param array $matchResults
* @return ActionRequest
*/
protected function createActionRequest(Request $httpRequest, array $matchResults = NULL)
{
$actionRequest = new ActionRequest($httpRequest);
if ($matchResults !== NULL) {
$requestArguments = $actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$actionRequest->setArguments($mergedArguments);
}
return $actionRequest;
}
示例2: route
/**
* Routes the specified web request by setting the controller name, action and possible
* parameters. If the request could not be routed, it will be left untouched.
*
* @param \TYPO3\Flow\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router.
* @return \TYPO3\Flow\Mvc\ActionRequest
*/
public function route(Request $httpRequest)
{
$this->actionRequest = $httpRequest->createActionRequest();
$matchResults = $this->findMatchResults($httpRequest);
if ($matchResults !== NULL) {
$requestArguments = $this->actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$this->actionRequest->setArguments($mergedArguments);
}
$this->setDefaultControllerAndActionNameIfNoneSpecified();
return $this->actionRequest;
}
示例3: __construct
/**
* @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
* @param \TYPO3\Flow\Mvc\ActionRequest $request
* @param \TYPO3\Flow\Http\Response $response
* @throws \TYPO3\Form\Exception\IdentifierNotValidException
* @internal
*/
public function __construct(\TYPO3\Form\Core\Model\FormDefinition $formDefinition, \TYPO3\Flow\Mvc\ActionRequest $request, \TYPO3\Flow\Http\Response $response)
{
$this->formDefinition = $formDefinition;
$rootRequest = $request->getMainRequest() ?: $request;
$pluginArguments = $rootRequest->getPluginArguments();
$this->request = new ActionRequest($request);
$formIdentifier = $this->formDefinition->getIdentifier();
$this->request->setArgumentNamespace('--' . $formIdentifier);
if (isset($pluginArguments[$formIdentifier])) {
$this->request->setArguments($pluginArguments[$formIdentifier]);
}
$this->response = $response;
}
示例4: 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));
}
}
示例5: getReferringRequest
/**
* Returns an ActionRequest which referred to this request, if any.
*
* The referring request is not set or determined automatically but must be
* explicitly set through the corresponding internal argument "__referrer".
* This mechanism is used by Flow's form and validation mechanisms.
*
* @return ActionRequest the referring request, or NULL if no referrer found
*/
public function getReferringRequest()
{
if ($this->referringRequest !== null) {
return $this->referringRequest;
}
if (!isset($this->internalArguments['__referrer'])) {
return null;
}
if (is_array($this->internalArguments['__referrer'])) {
$referrerArray = $this->internalArguments['__referrer'];
$referringRequest = new ActionRequest($this->getHttpRequest());
$arguments = array();
if (isset($referrerArray['arguments'])) {
$serializedArgumentsWithHmac = $referrerArray['arguments'];
$serializedArguments = $this->hashService->validateAndStripHmac($serializedArgumentsWithHmac);
$arguments = unserialize(base64_decode($serializedArguments));
unset($referrerArray['arguments']);
}
$referringRequest->setArguments(Arrays::arrayMergeRecursiveOverrule($arguments, $referrerArray));
return $referringRequest;
} else {
$this->referringRequest = $this->internalArguments['__referrer'];
}
return $this->referringRequest;
}
示例6: passArgumentsToSubRequest
/**
* 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);
}
}
示例7: passArgumentsToPluginRequest
/**
* Pass the arguments which were addressed to the plugin to its own request
*
* @param ActionRequest $pluginRequest The plugin request
* @return void
*/
protected function passArgumentsToPluginRequest(ActionRequest $pluginRequest)
{
$arguments = $pluginRequest->getMainRequest()->getPluginArguments();
$pluginNamespace = $this->getPluginNamespace();
if (isset($arguments[$pluginNamespace])) {
$pluginRequest->setArguments($arguments[$pluginNamespace]);
}
}
示例8: pluginArgumentsOfActionRequestOverruleThoseOfTheHttpRequest
/**
* @test
*/
public function pluginArgumentsOfActionRequestOverruleThoseOfTheHttpRequest()
{
$this->actionRequest->setArguments(array('--pluginArgument' => 'action request'));
$expectedResult = array('pluginArgument' => 'action request');
$this->assertSame($expectedResult, $this->actionRequest->getPluginArguments());
}
示例9: route
/**
* @param Request $httpRequest
* @return ActionRequest
*/
protected function route(Request $httpRequest)
{
$actionRequest = new ActionRequest($httpRequest);
$matchResults = $this->router->route($httpRequest);
if ($matchResults !== null) {
$requestArguments = $actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$actionRequest->setArguments($mergedArguments);
}
return $actionRequest;
}
示例10: allArgumentsCanBeSetOrRetrievedAtOnce
/**
* @test
*/
public function allArgumentsCanBeSetOrRetrievedAtOnce()
{
$httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
$arguments = array('foo' => 'fooValue', 'bar' => 'barValue');
$actionRequest = new ActionRequest($httpRequest);
$actionRequest->setArguments($arguments);
$this->assertEquals($arguments, $actionRequest->getArguments());
}
示例11: createActionRequest
/**
* Creates a new Action Request request as a sub request to this HTTP request.
* Maps the arguments of this request to the new Action Request.
*
* @return \TYPO3\Flow\Mvc\ActionRequest
*/
public function createActionRequest()
{
$actionRequest = new ActionRequest($this);
$actionRequest->setArguments($this->arguments);
return $actionRequest;
}