Sha256: 0fa184f641a5927eb2a4c40787f77653a42117b560273cd0117a4b9af215db90

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

module GOVUKDesignSystemFormBuilder
  module Containers
    class RadioButtonsFieldset < Base
      include Traits::Hint
      include Traits::Error

      def initialize(builder, object_name, attribute_name, hint_text:, legend:, caption:, inline:, small:, classes:, &block)
        super(builder, object_name, attribute_name)

        @inline        = inline
        @small         = small
        @legend        = legend
        @caption       = caption
        @hint_text     = hint_text
        @classes       = classes
        @block_content = capture { block.call }
      end

      def html
        Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
          Containers::Fieldset.new(@builder, @object_name, @attribute_name, legend: @legend, caption: @caption, described_by: [error_element.error_id, hint_element.hint_id]).html do
            safe_join(
              [
                hint_element.html,
                error_element.html,
                Containers::Radios.new(@builder, inline: @inline, small: @small, classes: @classes).html do
                  @block_content
                end
              ]
            )
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-1.2.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-1.2.0b4 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb