<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">

<f:switch expression="{data.CType}">
    <f:case value="gridelements_pi1">
        <div id="c{data.uid}" class="grid-container ge-container frame frame-{data.frame_class} frame-type-{data.CType} frame-layout-{data.layout} {f:if( condition: data.space_before_class, then: ' frame-space-before-{data.space_before_class}' )}{f:if( condition: data.space_after_class, then: ' frame-space-after-{data.space_after_class}' )}">
            <f:if condition="{options.respectColumns}">
                <f:then>
                    <f:if condition="{options.respectRows}">
                        <f:then>
                            <f:render section="Rows" arguments="{_all}"/>
                        </f:then>
                        <f:else>
                            <f:render section="Columns" arguments="{_all}"/>
                        </f:else>
                    </f:if>
                </f:then>
                <f:else>
                    <f:render section="Default" arguments="{_all}"/>
                </f:else>
            </f:if>
        </div>
    </f:case>
    <f:defaultCase>
        <f:if condition="{data.CType}">
            <f:cObject typoscriptObjectPath="tt_content.{data.CType}" data="{data}" table="tt_content" />
        </f:if>
    </f:defaultCase>
</f:switch>

<f:section name="Default">
    <f:if condition="{children}">
        <f:for each="{children}" as="child">
            <f:render partial="Default"
                      arguments="{columns:columns, data: child.data, children: child.children, options: options}"/>
        </f:for>
    </f:if>
</f:section>

<f:section name="Columns">

    <f:if condition="{children}">
        <f:for each="{children}" as="column" key="columnNumber">
            <div id="c{data.uid}-{columnNumber}" class="col col-{columnNumber}">
                <f:for each="{column}" as="child">
                    <f:render partial="Default"
                              arguments="{columns:columns, data: child.data, children: child.children, options: options}"/>
                </f:for>
            </div>
        </f:for>
    </f:if>
</f:section>

<f:section name="Rows">

    <f:if condition="{children}">
        <f:for each="{children}" as="row" key="rowNumber">
            <div id="c{data.uid}-{rowNumber}" class="row row-{rowNumber}">
                <f:for each="{row}" as="column" key="columnNumber">
                    <div id="c{data.uid}-{rowNumber}-{columnNumber}" class="col {columns.{columnNumber}}">
                        <f:for each="{column}" as="child">
                            <f:render partial="Default"
                                      arguments="{columns:columns, data: child.data, children: child.children, options: options}"/>
                        </f:for>
                    </div>
                </f:for>
            </div>
        </f:for>
    </f:if>
</f:section>

</html>
