本文整理汇总了PHP中Magento\Framework\App\RequestInterface::setPostValue方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::setPostValue方法的具体用法?PHP RequestInterface::setPostValue怎么用?PHP RequestInterface::setPostValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::setPostValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeExecute
/**
* @param Attribute\Save $subject
* @param RequestInterface $request
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeExecute(Attribute\Save $subject, RequestInterface $request)
{
$data = $request->getPostValue();
if (isset($data['frontend_input'])) {
switch ($data['frontend_input']) {
case 'swatch_visual':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_VISUAL;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
case 'swatch_text':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_TEXT;
$data['use_product_image_for_swatch'] = 0;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
case 'select':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_DROPDOWN;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
}
}
return [$request];
}
示例2: aroundDispatch
/**
* Process massaction key
*
* @param \Magento\Backend\App\AbstractAction $subject
* @param callable $proceed
* @param \Magento\Framework\App\RequestInterface $request
*
* @return mixed
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function aroundDispatch(\Magento\Backend\App\AbstractAction $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
{
$key = $request->getPost('massaction_prepare_key');
if ($key) {
$postData = $request->getPost($key);
$value = is_array($postData) ? $postData : explode(',', $postData);
$request->setPostValue($key, $value ? $value : null);
}
return $proceed($request);
}
示例3: _performLogin
/**
* Performs login, if user submitted login form
*
* @param \Magento\Framework\App\RequestInterface $request
* @return bool
*/
protected function _performLogin(\Magento\Framework\App\RequestInterface $request)
{
$outputValue = true;
$postLogin = $request->getPost('login');
$username = isset($postLogin['username']) ? $postLogin['username'] : '';
$password = isset($postLogin['password']) ? $postLogin['password'] : '';
$request->setPostValue('login', null);
try {
$this->_auth->login($username, $password);
} catch (AuthenticationException $e) {
if (!$request->getParam('messageSent')) {
$this->messageManager->addError($e->getMessage());
$request->setParam('messageSent', true);
$outputValue = false;
}
}
return $outputValue;
}