<xf:checkboxrow
	label="{$option.title}"
	hint="{$hintHtml}"
	explain="{$explainHtml}"
	html="{$listedHtml}"
	rowclass="{$rowClass}">

	<xf:option name="{$inputName}[messageEnabled]" selected="$option.option_value.messageEnabled" data-hide="true"
		label="{{ phrase('start_welcome_conversation_on_registration') }}">

		<xf:dependent>
			<div>{{ phrase('other_participants:') }}</div>
			<xf:if is="$option.option_value.messageParticipants AND is_array($option.option_value.messageParticipants)">
				<xf:set var="$users" value="{{ $xf.app.em.getRepository('XF:User').getUsersByIdsOrdered($option.option_value.messageParticipants) }}" />
				<xf:set var="$value" value="{$users.pluckNamed('username')|join(', ')}" />
			<xf:else />
				<xf:set var="$value">{$xf.visitor.username}</xf:set>
			</xf:if>
			<xf:tokeninput name="{$inputName}[messageParticipants]" value="{$value}" href="{{ link('users/find') }}">
				<xf:explain>{{ phrase('list_usernames_of_users_who_will_be_invited_to_this_conversation') }}</xf:explain>
			</xf:tokeninput>
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('conversation_title:') }}</div>
			<xf:textbox name="{$inputName}[messageTitle]" value="{$option.option_value.messageTitle}" placeholder="{{ phrase('conversation_title...') }}" maxlength="100" />
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('conversation_message:') }}</div>
			<xf:textarea name="{$inputName}[messageBody]" value="{$option.option_value.messageBody}" rows="5" autosize="true" />
			<p class="formRow-explain">{{ phrase('following_placeholders_will_be_replaced_in_message_for_conversation') }} {{ phrase('you_may_also_use_phrase_title_which_will_be_replaced') }}</p>
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('conversation_options:') }}</div>
			<xf:checkbox>
				<xf:option name="{$inputName}[messageOpenInvite]" value="1" selected="$option.option_value.messageOpenInvite">
					{{ phrase('allow_anyone_in_conversation_to_invite_others') }}
				</xf:option>
				<xf:option name="{$inputName}[messageLocked]" value="1" selected="$option.option_value.messageLocked">
					{{ phrase('lock_conversation_no_responses_will_be_allowed') }}
				</xf:option>
			</xf:checkbox>
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('future_message_handling:') }}</div>
			<xf:radio name="{$inputName}[messageDelete]">
				<xf:option value="delete" selected="!$option.option_value.messageDelete OR $option.option_value.messageDelete == 'delete'"
					label="{{ phrase('leave_conversation_and_accept_future_messages') }}"
					explain="{{ phrase('should_conversation_receive_responses_restored_to_inbox') }}" />

				<xf:option value="delete_ignore" selected="$option.option_value.messageDelete == 'delete_ignore'"
					label="{{ phrase('leave_conversation_and_ignore_future_messages') }}"
					explain="{{ phrase('not_notified_of_responses_conversation_remain_deleted') }}" />

				<xf:option value="no_delete" selected="$option.option_value.messageDelete == 'no_delete'"
					label="{{ phrase('do_not_leave_conversation') }}"
					explain="{{ phrase('remain_in_inbox_and_notified_of_replies') }}" />
			</xf:radio>
		</xf:dependent>

	</xf:option>

	<xf:option name="{$inputName}[emailEnabled]" selected="$option.option_value.emailEnabled" data-hide="true"
		label="{{ phrase('send_welcome_email_on_registration') }}">

		<xf:dependent>
			<div>{{ phrase('from_name:') }}</div>
			<xf:textbox name="{$inputName}[emailFromName]" value="{{ $option.option_value.emailFromName ? $option.option_value.emailFromName : $xf.options.boardTitle }}" />
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('from_email:') }}</div>
			<xf:textbox name="{$inputName}[emailFromEmail]" value="{{ $option.option_value.emailFromEmail ? $option.option_value.emailFromEmail : $xf.options.defaultEmailAddress }}" type="email" />
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('email_title:') }}</div>
			<xf:textbox name="{$inputName}[emailTitle]" value="{$option.option_value.emailTitle}" />
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('email_format:') }}</div>
			<xf:radio name="{$inputName}[emailFormat]" value="{$option.option_value.emailFormat}">
				<xf:option value="plain" label="{{ phrase('plain_text') }}" selected="!$option.option_value.emailFormat OR $option.option_value.emailFormat == 'plain'" />
				<xf:option value="html" label="{{ phrase('html') }}" />
			</xf:radio>
			<p class="formRow-explain">{{ phrase('note_that_email_clients_handle_html_in_widely_varying_ways') }}</p>
		</xf:dependent>

		<xf:dependent>
			<div>{{ phrase('email_body:') }}</div>
			<xf:textarea name="{$inputName}[emailBody]" value="{$option.option_value.emailBody}" rows="5" autosize="true" />
			<p class="formRow-explain">{{ phrase('following_placeholders_will_be_replaced_in_message_for_welcome_email') }} {{ phrase('you_may_also_use_phrase_title_which_will_be_replaced') }}</p>
		</xf:dependent>
	</xf:option>
</xf:checkboxrow>