The method $this->validateParams($params) validates parameters, for example the input-params of a form send with a post-request. It uses standard validation based on field-types. Additionally you can add validation rules with regex in the form-definitions of your yaml-configuration-file.

  • @param: (array) $params. The parameters to validate.
  • @return: (mixed) Returns the validated parameters if successful, otherwise returns false.

Example Usage


namespace Plugins\Myplugin;

use \Typemill\Plugin;

class Myplugin extends Plugin
    public function getforminput(Request $request, Response $response, $args)
        $forminput = $request->getParsedBody();
        $validvalues = $this->validateParams($forminput);
            # errors are added to session automatically
            # here you could send user to an error page
           # or get the referrer, redirect to the referrer and show errors in form

        # here you can do something with the validvalues from the form

See chapter about public forms for more details. Check the plugin contactform as a first starting point how to work with public forms.