<xf:if is="$page.isInsert()">
	<xf:title>{{ phrase('add_page') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_page:') }} {$node.title}</xf:title>
</xf:if>

<xf:pageaction if="$page.isUpdate()">
	<xf:button href="{{ link('pages/delete', $node) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('pages/save', $node) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:macro template="node_edit_macros" name="node_name" arg-node="{$node}" arg-optional="{{ false }}" />

			<xf:macro template="node_edit_macros" name="title" arg-node="{$node}" />
			<xf:macro template="node_edit_macros" name="description" arg-node="{$node}" />
			<xf:macro template="node_edit_macros" name="position" arg-node="{$node}" arg-nodeTree="{$nodeTree}" />
			<xf:macro template="node_edit_macros" name="navigation" arg-node="{$node}" arg-navChoices="{$navChoices}" />

			<xf:codeeditorrow name="template" value="{{ $page.isUpdate() ? $page.MasterTemplate.template : '' }}"
				mode="html"
				hint="{{ $page.isUpdate() ? $page.getTemplateName() : '' }}"
				class="codeEditor--short"
				label="{{ phrase('template_html') }}"
				explain="{{ phrase('you_may_use_xenforo_template_syntax_here') }}" />

			<xf:checkboxrow rowclass="surplusLabel"
				label="{{ phrase('optional_components') }}">

				<xf:option name="log_visits" selected="$page.log_visits"
					label="{{ phrase('log_and_count_visits_to_this_page') }}" />

				<xf:option name="list_siblings" selected="$page.list_siblings"
					label="{{ phrase('list_sibling_nodes') }}" />

				<xf:option name="list_children" selected="$page.list_children"
					label="{{ phrase('list_child_nodes') }}" />
			</xf:checkboxrow>

			<xf:formrow rowtype="input"
				label="{{ phrase('php_callback') }}"
				explain="{{ phrase('page_callback_explanation_html') }}">

				<xf:macro template="helper_callback_fields" name="callback_fields" arg-data="{$page}" />
			</xf:formrow>

			<xf:checkboxrow>
				<xf:option name="advanced_mode" value="1" selected="{$page.advanced_mode}"
					label="{{ phrase('advanced_mode') }}"
					hint="{{ phrase('if_enabled_html_for_your_page_will_not_be_contained_within_block') }}" />
			</xf:checkboxrow>

			<xf:macro template="node_edit_macros" name="style" arg-node="{$node}" arg-styleTree="{$styleTree}" />
		</div>

		<xf:submitrow sticky="true" icon="save" />
	</div>

</xf:form>