src/Form/ContactForm.php
protected function _buildValidator(Validator $validator)
    {
        $validator->provider('googleRecaptcha', 'Wasabi\Core\Model\Validation\GoogleRecaptchaValidationProvider');

        return $validator
            ->notEmpty('name', __d('wasabi_core', 'Please enter your name.'))
            ->notEmpty('email', __d('wasabi_core', 'Please enter your email address.'))
            ->add('email', 'email', ['rule' => 'email', 'message' => __d('wasabi_core', 'Please enter a valid email address.')])
            ->notEmpty('subject', __d('wasabi_core', 'Please enter a subject for your contact request.'))
            ->notEmpty('message', __d('wasabi_core', 'Please provide a message for your contact request.'))
            ->notEmpty('g-recaptcha-response', __d('wasabi_core', 'Please confirm you are human.'))
            ->add('g-recaptcha-response', 'googleRecaptcha', [
                'rule' => 'googleRecaptcha',
                'message' => __d('wasabi_core', 'Please confirm you are human.'),
                'provider' => 'googleRecaptcha'
            ]);
    }
protected function _buildValidator(Validator $validator)
    {
        $validator->provider('googleRecaptcha', 'Wasabi\Core\Model\Validation\GoogleRecaptchaValidationProvider');

        return $validator
            ->notEmpty('name', __d('wasabi_core', 'Please enter your name.'))
            ->notEmpty('email', __d('wasabi_core', 'Please enter your email address.'))
            ->add('email', 'email', ['rule' => 'email', 'message' => __d('wasabi_core', 'Please enter a valid email address.')])
            ->notEmpty('subject', __d('wasabi_core', 'Please enter a subject for your contact request.'))
            ->notEmpty('message', __d('wasabi_core', 'Please provide a message for your contact request.'))
            ->notEmpty('g-recaptcha-response', __d('wasabi_core', 'Please confirm you are human.'))
            ->add('g-recaptcha-response', 'googleRecaptcha', [
                'rule' => 'googleRecaptcha',
                'message' => __d('wasabi_core', 'Please confirm you are human.'),
                'provider' => 'googleRecaptcha'
            ]);
    }
protected function _buildValidator ( Validator $ validator ) { $ validator -> provider ( 'googleRecaptcha' , 'Wasabi\Core\Model\Validation\GoogleRecaptchaValidationProvider' ) ; return $ validator -> notEmpty ( 'name' , __d ( 'wasabi_core' , 'Please enter your name.' ) ) -> notEmpty ( 'email' , __d ( 'wasabi_core' , 'Please enter your email address.' ) ) -> add ( 'email' , 'email' , [ 'rule' => 'email' , 'message' => __d ( 'wasabi_core' , 'Please enter a valid email address.' ) ] ) -> notEmpty ( 'subject' , __d ( 'wasabi_core' , 'Please enter a subject for your contact request.' ) ) -> notEmpty ( 'message' , __d ( 'wasabi_core' , 'Please provide a message for your contact request.' ) ) -> notEmpty ( 'g-recaptcha-response' , __d ( 'wasabi_core' , 'Please confirm you are human.' ) ) -> add ( 'g-recaptcha-response' , 'googleRecaptcha' , [ 'rule' => 'googleRecaptcha' , 'message' => __d ( 'wasabi_core' , 'Please confirm you are human.' ) , 'provider' => 'googleRecaptcha' ] ) ; }
Validation rules for the submitted fields of this form.

@param Validator $validator The validator to customize.
@return $this
Validation rules for the submitted fields of this form .