{namespace neos=Neos\Neos\ViewHelpers}
<f:layout name="Default" />

<f:section name="head">
	<title><neos:backend.translate id="{title}" /></title>

	<link
		rel="stylesheet"
		type="text/css"
		href="{f:uri.resource(package: 'Neos.Neos', path: 'Styles/{f:if(condition: moduleConfiguration.mainStylesheet, then: moduleConfiguration.mainStylesheet, else: settings.moduleConfiguration.mainStylesheet)}')}.css?bust={neos:backend.cssBuiltVersion()}"
	/>

	<f:if condition="{moduleConfiguration.additionalResources.styleSheets}">
		<f:for
			each="{moduleConfiguration.additionalResources.styleSheets}"
			as="additionalResource"
		>
			<link
				rel="stylesheet"
				href="{f:uri.resource(path: additionalResource)}"
			/>
		</f:for>
	</f:if>

	<f:for
		each="{settings.moduleConfiguration.additionalResources.styleSheets}"
		as="additionalResource"
	>
		<link
			rel="stylesheet"
			href="{f:uri.resource(path: additionalResource)}"
		/>
	</f:for>

	<f:if condition="{moduleConfiguration.additionalResources.javaScripts}">
		<f:for
			each="{moduleConfiguration.additionalResources.javaScripts}"
			as="additionalResource"
		>
			<script src="{f:uri.resource(path: additionalResource)}"></script>
		</f:for>
	</f:if>

	<script type="text/javascript">
		// TODO: Get rid of those global variables
		{neos:backend.javascriptConfiguration()}
	</script>

	<link
		rel="neos-xliff"
		href="{f:uri.action(action: 'xliffAsJson', arguments: {locale: '{neos:backend.interfaceLanguage()}', version: '{neos:backend.xliffCacheVersion()}'}, controller: 'Backend\Backend', package: 'Neos.Neos', absolute: true) -> f:format.raw()}"
	/>
</f:section>

<f:section name="body">
	<body class="neos neos-module neos-controls neos-module-{moduleClass}">
		<div class="neos-module-wrap">
			<ul class="neos-breadcrumb">
				<f:for
					each="{moduleBreadcrumb}"
					key="path"
					as="configuration"
					iteration="iterator"
				>
					<f:if condition="{configuration.hideInMenu}">
						<f:else>
							<li>
								<neos:link.module
									path="{path}"
									class="{f:if(condition: iterator.isLast, then: 'active')}"
									title="{f:if(condition: configuration.description, then: '{neos:backend.translate(id: configuration.description)}')}"
									additionalAttributes="{data-neos-toggle: 'tooltip', data-placement: 'bottom'}"
									><i class="{configuration.icon}"></i>
									<neos:backend.translate
										source="Modules"
										id="{configuration.label}"
								/></neos:link.module>
								<f:if condition="{iterator.isLast}"
									><f:else><span class="neos-divider">/</span></f:else></f:if
								>
							</li>
						</f:else>
					</f:if>
				</f:for>
			</ul>
			<f:render partial="Module/FlashMessages" />
			<f:if condition="{moduleContents}">
				{moduleContents -> f:format.raw()}
			</f:if>
			<div id="neos-application" class="neos">
				<div id="neos-top-bar">
					<div class="neos-top-bar-left">
						<f:render partial="Backend/Menu" arguments="{_all}" />
						<f:render partial="Backend/Branding" arguments="{primaryModuleUri: primaryModuleUri}" />
					</div>
				</div>
				<f:render
					partial="Backend/Menu"
					arguments="{sites: sites, modules: modules, modulePath: moduleConfiguration.path}"
				/>
			</div>
		</div>
		<f:for
			each="{settings.moduleConfiguration.additionalResources.javaScripts}"
			as="additionalResource"
		>
			<script src="{f:uri.resource(path: additionalResource)}"></script>
		</f:for>
	</body>
</f:section>
