<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderRenderable renderable="{element}">
    <f:render partial="Field/Field" arguments="{element: element, renderFieldset: '{element.properties.renderFieldset}', doNotShowLabel: '{element.properties.legendVisuallyHidden}'}" contentAs="elementContent">
        <f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">

            <f:variable name="errorClass">{f:if(condition: '{validationResults.errors}', then: '{element.rootForm.renderingOptions.fieldProperties.errorClassAttribute}')}</f:variable>
            <div id="{element.uniqueIdentifier}" class="{errorClass}" role="radiogroup" aria-label="{element.label}">
                <f:for each="{element.properties.options}" as="label" key="value" iteration="idIterator">
                    <f:if condition="{element.properties.elementDescription}">
                        <f:variable name="aria" value="{describedby: '{element.uniqueIdentifier}-desc'}" />
                    </f:if>
                    <f:if condition="{validationResults.errors} && {idIterator.isFirst}">
                        <f:variable name="aria" value="{invalid: 'true', describedby: '{element.uniqueIdentifier}-errors'}" />
                    </f:if>

                    <div class="{element.properties.containerClassAttribute}">
                        <label class="{element.properties.labelClassAttribute}" for="{element.uniqueIdentifier}-{idIterator.index}">
                            <f:form.radio
                                property="{element.identifier}"
                                id="{element.uniqueIdentifier}-{idIterator.index}"
                                class="{element.properties.elementClassAttribute}"
                                value="{value}"
                                errorClass="{element.rootForm.renderingOptions.fieldProperties.errorClassAttribute}"
                                additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}"
                                aria="{aria}"
                            />
                            <span class="{element.properties.labelTextClassAttribute}">{formvh:translateElementProperty(element: element, property: '{0: \'options\', 1: value}')}</span>
                        </label>
                    </div>
                </f:for>
            </div>
            <f:if condition="{validationResults.flattenedErrors} && {element.properties.renderFieldset} == '1'">
                <span id="{element.uniqueIdentifier}-errors" class="{element.rootForm.renderingOptions.fieldProperties.errorMsgClassAttribute}" role="alert">
                    <f:for each="{validationResults.errors}" as="error">
                        <f:format.htmlspecialchars>{formvh:translateElementError(element: element, error: error)}</f:format.htmlspecialchars>
                        <br/>
                    </f:for>
                </span>
            </f:if>
        </f:form.validationResults>
    </f:render>
</formvh:renderRenderable>
</html>
