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?


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;
| improve this answer | |

Your Answer

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