def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
      draw_form_group_fieldset(bootstrap, method) do
        if bootstrap.custom_control
          label_css_class = "custom-control-label"

          form_check_css_class = "custom-control"
          form_check_css_class +=
            case type
            when :radio_button then " custom-radio"
            when :check_box    then " custom-checkbox"
            end

          form_check_css_class += " custom-control-inline" if bootstrap.check_inline

          add_css_class!(html_options, "custom-control-input")

        else
          label_css_class = "form-check-label"

          form_check_css_class = "form-check"
          form_check_css_class += " form-check-inline" if bootstrap.check_inline

          add_css_class!(html_options, "form-check-input")
        end

        errors    = draw_errors(method)
        help_text = draw_help(bootstrap.help)

        add_css_class!(html_options, "is-invalid") if errors.present?

        content = "".html_safe
        collection.each_with_index do |item, index|
          item_value  = item.send(value_method)
          item_text   = item.send(text_method)

          content << content_tag(:div, class: form_check_css_class) do
            concat yield method, item_value, html_options
            concat label(method, item_text, value: item_value, class: label_css_class)
            if ((collection.count - 1) == index) && !bootstrap.check_inline
              concat errors     if errors.present?
              concat help_text  if help_text.present?
            end
          end
        end

        if bootstrap.check_inline
          content << errors     if errors.present?
          content << help_text  if help_text.present?
        end

        content
      end
    end
def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
      draw_form_group_fieldset(bootstrap, method) do
        if bootstrap.custom_control
          label_css_class = "custom-control-label"

          form_check_css_class = "custom-control"
          form_check_css_class +=
            case type
            when :radio_button then " custom-radio"
            when :check_box    then " custom-checkbox"
            end

          form_check_css_class += " custom-control-inline" if bootstrap.check_inline

          add_css_class!(html_options, "custom-control-input")

        else
          label_css_class = "form-check-label"

          form_check_css_class = "form-check"
          form_check_css_class += " form-check-inline" if bootstrap.check_inline

          add_css_class!(html_options, "form-check-input")
        end

        errors    = draw_errors(method)
        help_text = draw_help(bootstrap.help)

        add_css_class!(html_options, "is-invalid") if errors.present?

        content = "".html_safe
        collection.each_with_index do |item, index|
          item_value  = item.send(value_method)
          item_text   = item.send(text_method)

          content << content_tag(:div, class: form_check_css_class) do
            concat yield method, item_value, html_options
            concat label(method, item_text, value: item_value, class: label_css_class)
            if ((collection.count - 1) == index) && !bootstrap.check_inline
              concat errors     if errors.present?
              concat help_text  if help_text.present?
            end
          end
        end

        if bootstrap.check_inline
          content << errors     if errors.present?
          content << help_text  if help_text.present?
        end

        content
      end
    end
Rendering of choices for checkboxes and radio buttons