本文整理汇总了PHP中Magento\Framework\App\RequestInterface::getUserParams方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::getUserParams方法的具体用法?PHP RequestInterface::getUserParams怎么用?PHP RequestInterface::getUserParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::getUserParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRouteParams
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function setRouteParams(array $data, $unsetOldParams = true)
{
if (isset($data['_type'])) {
$this->setType($data['_type']);
unset($data['_type']);
}
if (isset($data['_forced_secure'])) {
$this->setSecure((bool) $data['_forced_secure']);
$this->setSecureIsForced(true);
unset($data['_forced_secure']);
} elseif (isset($data['_secure'])) {
$this->setSecure((bool) $data['_secure']);
unset($data['_secure']);
}
if (isset($data['_absolute'])) {
unset($data['_absolute']);
}
if ($unsetOldParams) {
$this->unsetData('route_params');
}
if (isset($data['_current'])) {
if (is_array($data['_current'])) {
foreach ($data['_current'] as $key) {
if (array_key_exists($key, $data) || !$this->request->getUserParam($key)) {
continue;
}
$data[$key] = $this->request->getUserParam($key);
}
} elseif ($data['_current']) {
foreach ($this->request->getUserParams() as $key => $value) {
if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
continue;
}
$data[$key] = $value;
}
foreach ($this->request->getQuery() as $key => $value) {
$this->queryParamsResolver->setQueryParam($key, $value);
}
}
unset($data['_current']);
}
if (isset($data['_use_rewrite'])) {
unset($data['_use_rewrite']);
}
foreach ($data as $key => $value) {
$this->setRouteParam($key, $value);
}
return $this;
}
示例2: setRouteParams
/**
* {@inheritdoc}
*/
public function setRouteParams(array $data, $unsetOldParams = true)
{
if (isset($data['_type'])) {
$this->setType($data['_type']);
unset($data['_type']);
}
if (isset($data['_scope'])) {
$this->setScope($data['_scope']);
unset($data['_scope']);
}
if (isset($data['_forced_secure'])) {
$this->setSecure((bool) $data['_forced_secure']);
$this->setSecureIsForced(true);
unset($data['_forced_secure']);
} elseif (isset($data['_secure'])) {
$this->setSecure((bool) $data['_secure']);
unset($data['_secure']);
}
if (isset($data['_absolute'])) {
unset($data['_absolute']);
}
if ($unsetOldParams) {
$this->unsetData('route_params');
}
if (isset($data['_current'])) {
if (is_array($data['_current'])) {
foreach ($data['_current'] as $key) {
if (array_key_exists($key, $data) || !$this->_request->getUserParam($key)) {
continue;
}
$data[$key] = $this->_request->getUserParam($key);
}
} elseif ($data['_current']) {
foreach ($this->_request->getUserParams() as $key => $value) {
if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
continue;
}
$data[$key] = $value;
}
foreach ($this->_request->getQuery() as $key => $value) {
$this->_queryParamsResolver->setQueryParam($key, $value);
}
}
unset($data['_current']);
}
if (isset($data['_use_rewrite'])) {
unset($data['_use_rewrite']);
}
if (isset($data['_scope_to_url']) && (bool) $data['_scope_to_url'] === true) {
$store = $this->getScope() ?: $this->_storeManager->getStore();
if (!$this->_scopeConfig->getValue(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getScope()) && !$this->_storeManager->hasSingleStore()) {
$this->_queryParamsResolver->setQueryParam('___store', $store->getCode());
}
}
unset($data['_scope_to_url']);
foreach ($data as $key => $value) {
$this->setRouteParam($key, $value);
}
return $this;
}