Class: GOVUKDesignSystemFormBuilder::Elements::CollectionSelect
- Includes:
- 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:, options: {}, **kwargs, &block) ⇒ CollectionSelect
constructor
A new instance of CollectionSelect.
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:, options: {}, **kwargs, &block) ⇒ CollectionSelect
Returns a new instance of CollectionSelect.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/govuk_design_system_formbuilder/elements/collection_select.rb', line 11 def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, label:, caption:, form_group:, options: {}, **kwargs, &block) super(builder, object_name, attribute_name, &block) @collection = collection @value_method = value_method @text_method = text_method @options = @label = label @caption = @hint = hint @form_group = form_group @html_attributes = kwargs # 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
31 32 33 34 35 |
# File 'lib/govuk_design_system_formbuilder/elements/collection_select.rb', line 31 def html Containers::FormGroup.new(*bound, **@form_group).html do safe_join([label_element, supplemental_content, hint_element, error_element, collection_select]) end end |