Class: GOVUKDesignSystemFormBuilder::Elements::Radios::CollectionRadioButton
- Inherits:
-
Base
- Object
- Base
- GOVUKDesignSystemFormBuilder::Elements::Radios::CollectionRadioButton
- Includes:
- Traits::CollectionItem, Traits::Hint
- Defined in:
- lib/govuk_design_system_formbuilder/elements/radios/collection_radio_button.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, item, value_method:, text_method:, hint_method:, bold_labels:, link_errors: false) ⇒ CollectionRadioButton
constructor
A new instance of CollectionRadioButton.
Methods included from Traits::Hint
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, item, value_method:, text_method:, hint_method:, bold_labels:, link_errors: false) ⇒ CollectionRadioButton
Returns a new instance of CollectionRadioButton.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/govuk_design_system_formbuilder/elements/radios/collection_radio_button.rb', line 12 def initialize(builder, object_name, attribute_name, item, value_method:, text_method:, hint_method:, bold_labels:, link_errors: false) super(builder, object_name, attribute_name) @item = item @value = retrieve(item, value_method) @label_text = retrieve(item, text_method) @hint_text = retrieve(item, hint_method) @link_errors = link_errors @bold_labels = bold_labels end |
Instance Method Details
#html ⇒ Object
23 24 25 26 27 |
# File 'lib/govuk_design_system_formbuilder/elements/radios/collection_radio_button.rb', line 23 def html tag.div(class: %(#{brand}-radios__item)) do safe_join([radio, label_element, hint_element]) end end |