Method: CCS::Components::GovUK::Field::Inputs::Item::Checkbox::Form#initialize

Defined in:
lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb

#initialize(attribute:, label:, **options) ⇒ Form

Returns a new instance of Form.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb', line 19

def initialize(attribute:, label:, **options)
  super

  (label[:attributes] ||= {})[:value] = @value
  label[:attributes][:for] = @options[:attributes][:id] if @options[:attributes][:id]

  @options[:attributes][:multiple] = true
  @options[:attributes][:include_hidden] = false

  @label = Label.new(attribute: attribute, form: @options[:form], context: @context, **label)
end