Class: GOVUKDesignSystemFormBuilder::Elements::CheckBoxes::Label
- Includes:
- Traits::Localisation
- Defined in:
- lib/govuk_design_system_formbuilder/elements/check_boxes/label.rb
Constant Summary
Constants included from Traits::Localisation
Traits::Localisation::BASE_NAME_REGEXP
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, checkbox, value:, link_errors: true) ⇒ Label
constructor
A new instance of Label.
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, checkbox, value:, link_errors: true) ⇒ Label
Returns a new instance of Label.
9 10 11 12 13 14 15 |
# File 'lib/govuk_design_system_formbuilder/elements/check_boxes/label.rb', line 9 def initialize(builder, object_name, attribute_name, checkbox, value:, link_errors: true) super(builder, object_name, attribute_name) @checkbox = checkbox @value = value @link_errors = link_errors end |
Instance Method Details
#html ⇒ Object
17 18 19 20 21 |
# File 'lib/govuk_design_system_formbuilder/elements/check_boxes/label.rb', line 17 def html @checkbox.label(for: field_id(link_errors: @link_errors), class: label_classes) do label_content.to_s end end |