Module: Katalyst::GoogleApis::GOVUKFormBuilder

Defined in:
app/helpers/katalyst/google_apis/govuk_form_builder.rb

Defined Under Namespace

Classes: Recaptcha

Instance Method Summary collapse

Instance Method Details

#govuk_recaptcha_field(attribute_name = :recaptcha_token, form_group: {}, before_input: nil, after_input: nil) ⇒ ActiveSupport::SafeBuffer

Generates a Google recaptcha input that shows errors.

Examples:

A google recaptcha input

= f.govuk_recaptcha_field

Parameters:

  • attribute_name (Symbol) (defaults to: :recaptcha_token)

    The name of the attribute

  • form_group (Hash) (defaults to: {})

    configures the form group

  • before_input (String, Proc) (defaults to: nil)

    the content injected before the input. No content will be added if left nil

  • after_input (String, Proc) (defaults to: nil)

    the content injected after the input. No content will be added if left nil

  • kwargs (Hash)

    a customizable set of options

Options Hash (form_group:):

  • kwargs (Hash)

    additional attributes added to the form group

Returns:

  • (ActiveSupport::SafeBuffer)

    HTML output



19
20
21
22
# File 'app/helpers/katalyst/google_apis/govuk_form_builder.rb', line 19

def govuk_recaptcha_field(attribute_name = :recaptcha_token,
                          form_group: {}, before_input: nil, after_input: nil, **)
  Recaptcha.new(self, object_name, attribute_name, form_group:, before_input:, after_input:, **).html
end