% id_prefix ||= "radio-#{SecureRandom.hex(4)}" items ||= [] label ||= nil hint ||= nil error_message ||= nil hint_id = "hint-#{SecureRandom.hex(4)}" if hint error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message form_group_css_classes = %w(govuk-form-group) form_group_css_classes << "govuk-form-group--error" if error_message # check if any item is set as being conditional has_conditional = items.any? { |item| item.is_a?(Hash) && item[:conditional] } %> <%= content_tag :div, class: form_group_css_classes do %> <% if hint %> <%= render "govuk_publishing_components/components/hint", { id: hint_id, text: hint } %> <% end %> <% if error_message %> <%= render "govuk_publishing_components/components/error_message", { id: error_message_id, text: error_message } %> <% end %> <%= content_tag :div, class: "govuk-radios", data: { module: ('radios' if has_conditional) } do %> <% items.each_with_index do |item, index| %> <% if item === :or %>