-1

How to setup reCaptcha to appear on the registration form?

I followed above link & able to setup reCaptcha for Login form. It works fine.

Now for login I'm creating my custom Multi-Step form. 4-5 steps.

How we can define where to show this captcha or which code needs to be use so we can show it whenever it requires?

2

The following will add the captcha,

public function buildForm(array $form, FormStateInterface $form_state) {
...
  $form['captcha'] = array (
    '#type' => 'captcha',
    '#captcha_type' => 'recaptcha/reCAPTCHA'
  );
  return $form;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.