<xf:macro id="section_nav" arg-section="!">
	<xf:set var="$sectionNav" value="{{ $xf.app.get('navigation.admin').getTree($section) }}" />
	<xf:macro id="section_nav_block" arg-sectionNav="{$sectionNav}" />
</xf:macro>

<xf:macro id="section_nav_block" arg-sectionNav="!">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">{{ phrase('sub_sections') }}</h2>
			<div class="block-body">
				<xf:macro id="navigation_list" arg-children="{$sectionNav}" />
			</div>
		</div>
	</div>
</xf:macro>

<xf:macro id="navigation_list" arg-children="!" arg-depth="1">
	<xf:foreach loop="$children" value="$child">
		<xf:macro id="navigation_list_entry" arg-navigation="{$child.record}" arg-children="{$child.children}" arg-depth="{$depth}" />
	</xf:foreach>
</xf:macro>

<xf:macro id="navigation_list_entry" arg-navigation="!" arg-children="!" arg-depth="1">
	<xf:if is="$depth == 1 AND !$navigation.link">
		<div class="block-minorHeader">
			<div class="u-depth{{ $depth - 1 }}">
				<xf:if is="{$navigation.icon}"><xf:fa icon="fa-fw {$navigation.icon}" /></xf:if>
				{$navigation.title}
			</div>
		</div>
	<xf:else />
		<a href="{{ link($navigation.link) }}" class="blockLink">
			<div class="u-depth{{ $depth - 1 }}">{$navigation.title}</div>
		</a>
	</xf:if>
	<xf:macro id="navigation_list" arg-children="{$children}" arg-depth="{{ $depth + 1 }}" />
</xf:macro>