/** * Validate the current user * * @param \string $argument Form argument name * @return \boolean Successful validation */ protected function _validate($argument) { $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $request = $this->controllerContext->getRequest(); $request = $request->getOriginalRequest() ?: $request; $arguments = $request->getArguments(); return \Tollwerk\TwAntibot\Validation\Validator::validate($this->_extendedSettings, $argument && array_key_exists($argument, $arguments) ? $arguments[$argument] : null); }
/** * Validate the current user * * @param \string $argument Form argument name * @return \boolean Successful validation */ protected function _validate($argument = null) { $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $request = $this->controllerContext->getRequest(); $request = $request->getOriginalRequest() ?: $request; $arguments = $request->getArguments(); // If the form has just been submitted if ($argument && array_key_exists($argument, $arguments)) { try { \Tollwerk\TwAntibot\Validation\Validator::validate($this->_extendedSettings, $arguments[$argument]); } catch (\Tollwerk\TwAntibot\Validation\Exception $e) { die(get_class($e)); } } return true; }