Class: GOVUKDesignSystemFormBuilder::Elements::CollectionSelect
- Includes:
- Traits::ContentBeforeAndAfter, Traits::Error, Traits::HTMLAttributes, Traits::Hint, Traits::Label, Traits::Select, Traits::Supplemental
- Defined in:
- lib/govuk_design_system_formbuilder/elements/collection_select.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, label:, caption:, form_group:, before_input:, after_input:, options: {}, **kwargs, &block) ⇒ CollectionSelect
constructor
A new instance of CollectionSelect.
Methods included from Traits::ContentBeforeAndAfter
#after_input_content, #before_input_content
Methods included from Traits::HTMLAttributes
Methods included from Traits::Supplemental
Methods included from Traits::Hint
Methods included from Traits::Error
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, label:, caption:, form_group:, before_input:, after_input:, options: {}, **kwargs, &block) ⇒ CollectionSelect
Returns a new instance of CollectionSelect.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/govuk_design_system_formbuilder/elements/collection_select.rb', line 12 def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, label:, caption:, form_group:, before_input:, after_input:, options: {}, **kwargs, &block) super(builder, object_name, attribute_name, &block) @collection = collection @value_method = value_method @text_method = text_method = @label = label @caption = caption @hint = hint @form_group = form_group @html_attributes = kwargs @before_input = before_input @after_input = after_input # FIXME remove this soon, worth informing people who miss the release notes that the # args have changed though. if :html_options.in?(kwargs.keys) warn("GOVUKDesignSystemFormBuilder: html_options has been deprecated, use keyword arguments instead") end end |
Instance Method Details
#html ⇒ Object
34 35 36 37 38 |
# File 'lib/govuk_design_system_formbuilder/elements/collection_select.rb', line 34 def html Containers::FormGroup.new(*bound, **@form_group).html do safe_join([label_element, supplemental_content, hint_element, error_element, before_input_content, collection_select, after_input_content]) end end |