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

<f:layout name="Module"/>

<f:section name="Content">

    <f:be.pageRenderer
        includeJavaScriptModules="{
            0: '@typo3/backend/context-menu.js',
            1: '@typo3/backend/element/immediate-action-element.js',
            3: '@typo3/backend/utility/collape-state-persister.js',
            4: '@typo3/tstemplate/constant-editor.js'
        }"
    />

    <f:variable name="args" value="{0: 'web', 1: pageUid}" />
    <typo3-immediate-action action="TYPO3.Backend.Storage.ModuleStateStorage.update" args="{args -> f:format.json() -> f:format.htmlspecialchars()}"></typo3-immediate-action>

    <f:comment>
        Heading
    </f:comment>
    <h1>
        <f:if condition="{templateTitle}">
            <f:then>
                <f:translate
                    key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_ceditor.xlf:objectBrowserTitleWithTemplate"
                    arguments="{
                        0: '{templateTitle}'
                    }"
                />
            </f:then>
            <f:else>
                <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang.xlf:constantEditor" />
            </f:else>
        </f:if>
    </h1>

    <f:comment>
        Options
    </f:comment>
    <f:render
        partial="ConstantEditorOptions"
        arguments="{
            allTemplatesOnPage: allTemplatesOnPage,
            pageUid: pageUid,
            selectedTemplateUid: selectedTemplateUid,
            relevantCategories: relevantCategories,
            selectedCategory: selectedCategory
        }"
    />

    <f:comment>
        Main form
    </f:comment>
    <f:if condition="!{relevantCategories}">
        <f:then>
            <f:be.infobox title="{f:translate(key:'LLL:EXT:tstemplate/Resources/Private/Language/locallang_ceditor.xlf:noConstants')}">
                {f:translate(key:'LLL:EXT:tstemplate/Resources/Private/Language/locallang_ceditor.xlf:noConstantsDescription')}
            </f:be.infobox>
        </f:then>
        <f:else>
            <f:render partial="ConstantEditorFields" arguments="{_all}" />
        </f:else>
    </f:if>
</f:section>

</html>
