本文整理汇总了PHP中Nette\Application\Request::setParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setParameters方法的具体用法?PHP Request::setParameters怎么用?PHP Request::setParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\Request
的用法示例。
在下文中一共展示了Request::setParameters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: constructUrl
/**
* @param Application\Request $appRequest
* @param Nette\Http\Url $refUrl
* @return NULL|string
*/
public function constructUrl(Application\Request $appRequest, Nette\Http\Url $refUrl)
{
$parameters = $appRequest->getParameters();
if (isset($parameters['action']) && $parameters['action'] == FALSE) {
$parameters['action'] = NULL;
}
$appRequest->setParameters($parameters);
return parent::constructUrl($appRequest, $refUrl);
}
示例2: constructUrl
/**
* Constructs absolute URL from Request object
*
* @param \Nette\Application\Request $appRequest
* @param \Nette\Http\Url $refUrl
* @return string|NULL
*/
public function constructUrl(Application\Request $appRequest, \Nette\Http\Url $refUrl)
{
if ($appRequest->getPresenterName() != $this->getTargetPresenter()) {
return NULL;
}
$params = $appRequest->getParameters();
if (!isset($params['id']) && isset($params[0])) {
$params['id'] = $params[0];
unset($params[0]);
$appRequest->setParameters($params);
}
return parent::constructUrl($appRequest, $refUrl);
}
示例3: setRequestParams
/**
* @param \Nette\Application\Request
* @param array
* @return \Nette\Application\Request
*/
private function setRequestParams(\Nette\Application\Request $appRequest, array $params)
{
$metadata = $this->getDefaults();
if (!isset($params[self::PRESENTER_KEY])) {
throw new \InvalidStateException('Missing presenter in route definition.');
}
if (isset($metadata[self::MODULE_KEY])) {
if (!isset($params[self::MODULE_KEY])) {
throw new \InvalidStateException('Missing module in route definition.');
}
$presenter = $params[self::MODULE_KEY] . ':' . $params[self::PRESENTER_KEY];
unset($params[self::MODULE_KEY], $params[self::PRESENTER_KEY]);
} else {
$presenter = $params[self::PRESENTER_KEY];
unset($params[self::PRESENTER_KEY]);
}
$appRequest->setPresenterName($presenter);
$appRequest->setParameters($params);
return $appRequest;
}
示例4: modifyConstructRequest
/**
* Modify request by page
*
* @param \Nette\Application\Request $request
* @param RouteEntity $route
* @param $parameters
* @param string $domain
* @return \Nette\Application\Request
*/
protected function modifyConstructRequest(Request $request, RouteEntity $route, $parameters, $domain)
{
$request->setPresenterName(self::DEFAULT_MODULE . ':' . self::DEFAULT_PRESENTER);
$request->setParameters(array('module' => self::DEFAULT_MODULE, 'presenter' => self::DEFAULT_PRESENTER, 'action' => self::DEFAULT_ACTION, 'lang' => count($this->languages) > 1 ? isset($parameters['lang']) ? $parameters['lang'] : ($route->page->language ? $route->page->language->alias : $this->defaultLanguage) : NULL, 'slug' => $route->getUrl(), 'domain' => $route->domain ? $route->domain->domain : '') + $parameters);
return $request;
}