Class: GOVUKDesignSystemFormBuilder::Elements::Select
- Includes:
- Traits::ContentBeforeAndAfter, Traits::Error, Traits::HTMLAttributes, Traits::Hint, Traits::Label, Traits::Select
- Defined in:
- lib/govuk_design_system_formbuilder/elements/select.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, choices, options:, form_group:, label:, hint:, caption:, before_input:, after_input:, **kwargs, &block) ⇒ Select
constructor
A new instance of Select.
Methods included from Traits::ContentBeforeAndAfter
#after_input_content, #before_input_content
Methods included from Traits::HTMLAttributes
Methods included from Traits::Hint
Methods included from Traits::Error
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, choices, options:, form_group:, label:, hint:, caption:, before_input:, after_input:, **kwargs, &block) ⇒ Select
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/govuk_design_system_formbuilder/elements/select.rb', line 11 def initialize(builder, object_name, attribute_name, choices, options:, form_group:, label:, hint:, caption:, before_input:, after_input:, **kwargs, &block) # assign the block to an variable rather than passing to super so # we can send it through to #select super(builder, object_name, attribute_name) @block = block @form_group = form_group @hint = hint @label = label @caption = caption @choices = choices = @html_attributes = kwargs @before_input = before_input @after_input = after_input end |
Instance Method Details
#html ⇒ Object
28 29 30 31 32 |
# File 'lib/govuk_design_system_formbuilder/elements/select.rb', line 28 def html Containers::FormGroup.new(*bound, **@form_group).html do safe_join([label_element, hint_element, error_element, before_input_content, select, after_input_content]) end end |