本文整理汇总了PHP中Zend\Form\FormInterface::getInputFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP FormInterface::getInputFilter方法的具体用法?PHP FormInterface::getInputFilter怎么用?PHP FormInterface::getInputFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\FormInterface
的用法示例。
在下文中一共展示了FormInterface::getInputFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginTfaAction
public function loginTfaAction()
{
if (!$this->authSession->identity) {
return $this->redirect()->toRoute('login');
}
if ($this->getRequest()->isPost()) {
$this->verifyCodeForm->setData($this->getRequest()->getPost());
/** @var AccountInterface $account */
$account = $this->zourceIdentity($this->authSession->identity)->getAccount();
/** @var \ZourceUser\InputFilter\VerifyCode $inputFilter */
$inputFilter = $this->verifyCodeForm->getInputFilter();
$inputFilter->setOneTimePasswordType($account->getTwoFactorAuthenticationType());
$inputFilter->setOneTimePasswordCode($account->getTwoFactorAuthenticationCode());
if ($this->verifyCodeForm->isValid()) {
$this->authSession->verified = true;
return $this->redirectAfterLogin($account);
}
}
return new ViewModel(['verifyCodeForm' => $this->verifyCodeForm]);
}
示例2: handleGetRequest
/**
* @param FormInterface $form
* @return bool|array
*/
protected function handleGetRequest(FormInterface $form)
{
$container = $this->getSessionContainer();
if (null === $container->post) {
// No previous post, bail early
unset($container->files);
return false;
}
// Collect data from session
$post = $container->post;
$errors = $container->errors;
$isValid = $container->isValid;
unset($container->post);
unset($container->errors);
unset($container->isValid);
// Fill form with the data first, collections may alter the form/filter structure
$form->setData($post);
// Remove File Input validators and filters on previously uploaded files
// in case $form->isValid() or $form->bindValues() is run
$inputFilter = $form->getInputFilter();
$this->traverseInputs($inputFilter, $post, function ($input, $value) {
if ($input instanceof FileInput) {
$input->setAutoPrependUploadValidator(false)->setValidatorChain(new ValidatorChain())->setFilterChain(new FilterChain());
}
return $value;
});
// set previous state
$form->isValid();
// re-validate to bind values
if (null !== $errors) {
$form->setMessages($errors);
// overwrite messages
}
$this->setProtectedFormProperty($form, 'isValid', $isValid);
// force previous state
// Clear previous files from session data if form was valid
if ($isValid) {
unset($container->files);
}
return $post;
}
示例3: processFormData
/**
* @param FormInterface $form
* @param \Zend\Http\Request $request
* @param AdminMenu $adminMenu
*
* @return \Zend\Http\Response
*/
private function processFormData(FormInterface $form, \Zend\Http\Request $request, AdminMenu $adminMenu)
{
$form->setInputFilter($form->getInputFilter());
$form->setData($request->getPost());
if ($form->isValid()) {
$this->adminMenuTable->saveAdminMenu($adminMenu);
$this->setLayoutMessages('«' . $adminMenu->getCaption() . '» ' . $this->translate('SAVE_SUCCESS'), 'success');
}
return $this->redirect()->toUrl('/admin/admin-menu');
}
示例4: processFormData
/**
* @param FormInterface $form
* @param Content $content
* @param array $data
*
* @return void
*/
private function processFormData(FormInterface $form, Content $content, array $data)
{
$form->setInputFilter($form->getInputFilter());
$form->setData($data);
$this->saveFormData($form, $content);
}