Class: GOVUKDesignSystemFormBuilder::Containers::CheckBoxesFieldset

Inherits:
Base
  • Object
show all
Includes:
Traits::Error, Traits::Hint
Defined in:
lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb

Instance Method Summary collapse

Methods included from Traits::Hint

#hint_id

Methods included from Traits::Error

#error_id

Methods inherited from Base

#field_id, #to_s

Constructor Details

#initialize(builder, object_name, attribute_name, hint:, legend:, caption:, small:, form_group:, multiple:, **kwargs, &block) ⇒ CheckBoxesFieldset

Returns a new instance of CheckBoxesFieldset.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb', line 7

def initialize(builder, object_name, attribute_name, hint:, legend:, caption:, small:, form_group:, multiple:, **kwargs, &block)
  fail LocalJumpError, 'no block given' unless block_given?

  super(builder, object_name, attribute_name, &block)

  @legend          = legend
  @caption         = caption
  @hint            = hint
  @small           = small
  @form_group      = form_group
  @multiple        = multiple
  @html_attributes = kwargs
end

Instance Method Details

#htmlObject



21
22
23
24
25
26
27
# File 'lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb', line 21

def html
  Containers::FormGroup.new(*bound, **@form_group).html do
    Containers::Fieldset.new(*bound, **fieldset_options).html do
      safe_join([hint_element, error_element, hidden_field, checkboxes])
    end
  end
end