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

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

<xf:if is="!$page.canEdit()">
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		{{ phrase('only_limited_fields_in_item_may_be_edited') }}
	</div>
</xf:if>

<xf:form action="{{ link('help-pages/save', $page) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">

			<xf:textboxrow name="page_name" value="{$page.page_name}"
				readonly="{{ !$page.canEdit() }}"
				maxlength="{{ max_length($page, 'page_name') }}"
				label="{{ phrase('url_portion') }}">
				<xf:explain>
					{{ phrase('represents_portion_of_url_after_help_part_identify_page') }}
				</xf:explain>
			</xf:textboxrow>

			<xf:hiddenval name="page_id">{$page.page_id}</xf:hiddenval>

			<xf:textboxrow name="title" value="{{ $page.exists() ? $page.MasterTitle.phrase_text : '' }}"
				readonly="{{ !$page.canEdit() }}"
				label="{{ phrase('title') }}" />

			<xf:textboxrow name="description" value="{{ $page.exists() ? $page.MasterDescription.phrase_text : '' }}"
				readonly="{{ !$page.canEdit() }}"
				label="{{ phrase('description') }}" />

			<xf:macro template="display_order_macros" name="row"
				arg-value="{$page.display_order}"
				arg-explain="{{ ($xf.development AND $page.addon_id) ? phrase('field_value_maintained_addon_upgrade_explain') : '' }}" />

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

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

			<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}"
					arg-readOnly="{{ !$page.canEdit() }}" />
			</xf:formrow>

			<xf:checkboxrow>
				<xf:option name="active" value="1" selected="$page.active"
					hint="{{ ($xf.development AND $page.addon_id) ? phrase('field_value_maintained_addon_upgrade_explain') : '' }}">
					{{ phrase('enabled') }}
				</xf:option>
			</xf:checkboxrow>

			<xf:macro template="addon_macros" name="addon_edit" arg-addOnId="{$page.addon_id}" />
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>