Class: GOVUKDesignSystemFormBuilder::Elements::Radios::FieldsetRadioButton

Inherits:
Base
  • Object
show all
Includes:
Traits::Conditional, Traits::Hint, Traits::Label
Defined in:
lib/govuk_design_system_formbuilder/elements/radios/fieldset_radio_button.rb

Instance Method Summary collapse

Methods included from Traits::Hint

#hint_id

Methods inherited from Base

#to_s

Constructor Details

#initialize(builder, object_name, attribute_name, value, label:, hint:, link_errors:, &block) ⇒ FieldsetRadioButton

Returns a new instance of FieldsetRadioButton.


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/govuk_design_system_formbuilder/elements/radios/fieldset_radio_button.rb', line 11

def initialize(builder, object_name, attribute_name, value, label:, hint:, link_errors:, &block)
  super(builder, object_name, attribute_name)

  @value       = value
  @label       = label
  @hint        = hint
  @link_errors = has_errors? && link_errors

  if block_given?
    @conditional_content = wrap_conditional(block)
    @conditional_id      = conditional_id
  end
end

Instance Method Details

#htmlObject


25
26
27
# File 'lib/govuk_design_system_formbuilder/elements/radios/fieldset_radio_button.rb', line 25

def html
  safe_join([radio, @conditional_content])
end