<f:comment>
    Styling requires the colpos to be set to the string 'unused'. To preserve type safety in the
    controller, the string is only used in the template by setting the below "colpos" variable.
</f:comment>
<f:variable name="colpos" value="{f:if(condition: column.unused, then: 'unused', else: column.columnNumber)}"/>

<f:if condition="{languageColumns}">
    <f:then>
        <f:comment><!-- Language comparison view --></f:comment>
        <f:variable name="columnIdentifier" value="columnIdentifier_language-{column.context.siteLanguage.languageId}_column-{colpos}" />
    </f:then>
    <f:else>
        <f:comment><!-- Grid / Column view --></f:comment>
        <f:variable name="columnIdentifier" value="columnIdentifier_column-{colpos}" />
    </f:else>
</f:if>
<f:variable name="columnClasses">
    t3js-page-column t3-grid-cell t3-page-column
    {f:if(condition: column.identifierCleaned, then: 't3-grid-cell-{column.identifierCleaned}')}
    {f:if(condition: column.unassigned, then: 't3-grid-cell-unassigned')}
    {f:if(condition: '!{column.active} && !{column.unused}', then: 't3-grid-cell-restricted')}
    {f:if(condition: '!{column.active} && {hideRestrictedColumns} && !{column.unused}', then: 't3-grid-cell-hidden')}
</f:variable>

<td valign="top" colspan="{column.colSpan}" rowspan="{column.rowSpan}"
    data-colpos="{colpos}" data-language-uid="{column.context.siteLanguage.languageId}"
    data-tx-container-parent="{column.containerUid}"
    class="{columnClasses -> f:spaceless()}"
    role="group" aria-labelledby="{columnIdentifier}">
    <f:alias map="{columnHeaderLevel: 2}">
        <f:render partial="PageLayout/Grid/ColumnHeader" arguments="{_all}" />
    </f:alias>
    <f:if condition="{column.active} || {column.unused}">
        <div data-colpos="{column.columnNumber}" data-language-uid="{column.context.siteLanguage.languageId}"
             data-tx-container-parent="{column.containerUid}"
             class=" t3-page-ce-wrapper">
            <f:for each="{column.items}" as="item">
                <f:render partial="PageLayout/Record" arguments="{_all}" />
            </f:for>
        </div>
    </f:if>
    <f:format.raw>{column.afterSectionMarkup}</f:format.raw>
</td>
