<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}"
    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="{colpos}" data-language-uid="{column.context.siteLanguage.languageId}" 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:if condition="{column.unassigned}">
        <f:be.infobox
            title="{f:translate(domain: 'backend.layout', key: 'emptyColPos')}"
            message="{f:translate(domain: 'backend.layout', key: 'emptyColPos.message')}"
            state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::WARNING')}"
        />
    </f:if>
</td>
