Class: GOVUKDesignSystemFormBuilder::Elements::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:, **kwargs, &block) ⇒ Select
constructor
A new instance of Select.
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:, **kwargs, &block) ⇒ Select
Returns a new instance of Select.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/govuk_design_system_formbuilder/elements/select.rb', line 10 def initialize(builder, object_name, attribute_name, choices, options:, form_group:, label:, hint:, caption:, **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 = @choices = choices @options = @html_attributes = kwargs end |
Instance Method Details
#html ⇒ Object
25 26 27 28 29 |
# File 'lib/govuk_design_system_formbuilder/elements/select.rb', line 25 def html Containers::FormGroup.new(*bound, **@form_group).html do safe_join([label_element, hint_element, error_element, select]) end end |